0.9.2 • Published 5 years ago
router1-react v0.9.2
Router1 React
React components to use https://github.com/zxbodya/router1 library in react js application.
RouterContext
Used to pass router
context variable into components when rendering.
can be used as following:
// router - router1 instance
// renderApp - function that will render your app virtual dom
ReactDOM.render(
<RouterContext.Provider value={router}>
...
</RouterContext.Provider>,
appElement
);
Link
Used to generate links with router1, will handle user clicks and can highlight active links.
<Link route="contact" activeClassName="active" params={{routeParam: "value"}}>Contact</Link>
Also you can pass additional state data(to be used later when handling route change) using optional data param:
<Link
route="contact"
activeClassName="active"
params={{routeParam: "value"}}
state={{ noscroll: true }}
>
Contact
</Link>
ActivateWrap
Similar to Link
it can be used to highlight some block when route is active.
For example, when you need to add active
class to li
instead of link:
<ActivateWrap route="contact" activeClassName="active" params={{routeParam: "value"}} component="li">
<Link route="contact" params={{routeParam: "value"}}>Contact</Link>
</ActivateWrap>
Example
0.9.2
5 years ago
0.9.1
5 years ago
0.9.0
6 years ago
0.8.2
6 years ago
0.8.1
6 years ago
0.8.0
7 years ago
0.7.1
7 years ago
0.7.0
7 years ago
0.6.0
7 years ago
0.5.0
8 years ago
0.4.2
8 years ago
0.4.1
8 years ago
0.4.0
8 years ago
0.3.1
8 years ago
0.3.0
8 years ago
0.2.0
8 years ago
0.1.2
8 years ago
0.1.1
8 years ago
0.1.0
8 years ago