react-anchor
Functional factory to create anchor components that trigger custom actions. Uses
event.preventDefault
under the hood.
Installation
$ npm i --save react-anchor
Overview
var anchorFactory = ;var open = ; // create factory that generates links var profileLinkFactory = ; // create a new `<a>` tag ;
creates the following component:
var opts = className: 'profile-link foo-bar' href: 'gh/yoshuawuyts' onClick: handleClick; return reactDOM; { e; e; ;}
API
var linkFactory = AnchorFactory(openFunction)
Create a new anchorFactory, which returns an anchor component.
var AnchorFactory = ;var router = ; var anchorFactory = ;
linkFactory(url, inner)
Call the newly created anchorFactory and create a new anchor tag.
If you're using an object as argument, note that className
will extend the class set in the AnchorFactory.
So if the anchorFactory provides .link
and you create a tag with class .modal-link
you get .link .modal-link
.
var anchorTag = ;var otherTag = ;