the-route
Route of the-components
Installation
$ npm install the-route --save
Usage
'use strict' Component { superprops thisstate = i: 0 vertical: false } { return <div> <TheSpinStyle/> <TheRouteStyle/> <br/> <TheRouterHash> <TheLink exact to='/s1'>Show Stack</TheLink> <TheLink exact to='/'>Hide Stack</TheLink> <a onClick= this> Change direction </a> <TheRouteSwitch> <TheRoute path='/s1' > <TheRouteStack style=border: '4px solid #555' direction=thisstatevertical ? 'vertical' : 'horizontal' stack= '/s1' Component { return <div style=padding: '50px' background: '#EAA'> <h3>This is view 01</h3> <br/> <div style=display: 'flex' justifyContent: 'space-between'> <span> </span> <TheLink to='/s1/v2'>Go to view 02 >> </TheLink> </div> </div> } { console } '/s1/v2' Component { const pop = thisprops return <div style=padding: '50px' background: '#AEA' height: 920> <h3>This is view 02</h3> <br/> <div style=display: 'flex' justifyContent: 'space-between'> <a onClick= > << Back to view 01</a> <TheLink to='/s1/v2/v3'>Go to view 03 >> </TheLink> </div> </div> } { console } '/s1/v2/v3' Component { const pop = thisprops return <div style=padding: '50px' background: '#AAE'> <h3>This is view 03</h3> <br/> <div style=display: 'flex' justifyContent: 'space-between'> <a onClick= > << Back to view 02</a> <span></span> </div> </div> } { console const location history = thisprops history } > </TheRouteStack> </TheRoute> </TheRouteSwitch> <br/> <hr/> <br/> <h3>404</h3> <TheRouteStatus code="404"> <div>Page not found!</div> </TheRouteStatus> </TheRouterHash> </div> }
Components
TheRoute
Route of the-components
Props
Name | Type | Description | Default |
---|---|---|---|
animationDuration |
number | Animation duration | 400 |
component |
any | Component class | `` |
exact |
bool | Exact match | `` |
path |
string | Routing path | `` |
scrollToTop |
bool | Render function | false |
strict |
bool | Strict match | `` |
TheRouteStack
Tab for the-components
Props
Name | Type | Description | Default |
---|---|---|---|
direction |
enum | Stack direction | 'horizontal' |
stack |
array | Stacks | [] |
TheRouteStyle
Style for TheRoute
Props
Name | Type | Description | Default |
---|---|---|---|
options |
object | Style options | {} |
License
This software is released under the MIT License.