https://github.com/unirakun/hoc-little-router
redux-little-router HOC to render a component when the route is matching!
https://github.com/unirakun/hoc-little-router
hoc nantes react redux redux-little-router router
Last synced: about 1 month ago
JSON representation
redux-little-router HOC to render a component when the route is matching!
- Host: GitHub
- URL: https://github.com/unirakun/hoc-little-router
- Owner: unirakun
- License: mit
- Created: 2017-03-01T10:44:09.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T08:14:53.000Z (over 2 years ago)
- Last Synced: 2025-03-27T17:51:57.356Z (about 2 months ago)
- Topics: hoc, nantes, react, redux, redux-little-router, router
- Language: JavaScript
- Homepage:
- Size: 1.15 MB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# For now we deprecate this HOC (and our redux-little-router usage) in profit of [k-redux-router](https://github.com/unirakun/k-redux-router).
_Please open an issue if you want to argue about this decision._**Feel free to open PRs, we are still reviewing them**
-----
# hoc-little-router
[](https://circleci.com/gh/unirakun/hoc-little-router/tree/master) [](https://www.npmjs.com/package/hoc-little-router) [](https://coveralls.io/github/unirakun/hoc-little-router?branch=master) []() [](https://greenkeeper.io/)
redux-little-router HOC to render a component when the route is matching!
You need [redux-little-router](https://github.com/FormidableLabs/redux-little-router) for that HOC.
## Examples
**routes** (redux-little-router ones)
```es6
export default {
'/': {
title: 'HOME',
'/search': {
title: 'SEARCH',
},
},
}
```### Relative
The `Home` component will be printed when `redux-little-router` find a title that match `HOME` from URL and its parents.```es6
// ...
import router from 'hoc-little-router'class Home extends React.Component {
// ...export default router('HOME')(Home)
```- `/` : Home Component is **printed**
- `/search` : Home Component is **printed**### List screens
You can attach the same component to multiple routes like this:
```es6
import router from 'hoc-little-router'class Menu extends React.Component {
// ...export default router(['HOME', 'SEARCH'])(Menu)
```### Absolute
The `Home` component will be printed when `redux-little-router` find a title that match `HOME` from URL but **not** its parents.```es6
// ...
import router from 'hoc-little-router'class Home extends React.Component {
// ...export default router('HOME', { absolute: true })(Home)
// or
export default router.absolute('HOME')(Home)
```- `/` : Home Component is **printed**
- `/search` : Home Component is _**not** printed_# About uni rakun
**uni rakun** is created by two passionate french developers.Do you want to contact them ? Go to their [website](https://unirakun.fr)