Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
License
NotificationsYou must be signed in to change notification settings
streamich/react-router-lite
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Similar toreact-router but leaner.
Provide your route in the[route] prop to theRouter component and usetheRoute components to define your routes.
import{Router,Route}from'react-router-lite';<Routerroute="/foo/bar"><Route><span>1</span></Route><Routematch="/baz"><span>2</span></Route><Routematch="/foo"><span>3</span></Route><Routematch="/foo/bar"><span>4</span></Route></Router>;
You can use theSwitch component to render only the first route that matches.
import{Router,Switch,Route}from'react-router-lite';<Routerroute={'/any/string/goes/here'}><Switch><Routematch="/any/string"render={()=><div>hello world</div>}><Routematch="/any/string/goes"render={()=><div>not hello</div>}></Switch></Router>
The routes can be nested. When[truncate] prop is set, the nested routes willbe truncated to the parent route.
import{Router,Route}from'react-router-lite';<Routerroute="/foo/bar"><Routematch={'/foo'}truncate><span>foo</span><Routematch="/bar"><span>bar</span></Route></Route></Router>;
Unlicense — public domain.
About
No description, website, or topics provided.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.