1.0.1 • Published 6 years ago

@salsita/react-router v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

react-router

Install

Install this package with npm

npm i @salsita/react-router

or yarn

yarn add @salsita/react-router

API

Modules

Functions

Interfaces

RouterActions

See: redux-router5: Using the redux middleware

RouterSelectors

RouterSelectors.getCurrentRoute(state) ⇒ Route

Returns the current route

Kind: static method of RouterSelectors
Returns: Route - The current route

ParamTypeDescription
stateRootStateThe root state

RouterSelectors.getRouteParams(state) ⇒ object

Returns the params of current route

Kind: static method of RouterSelectors
Returns: object - The current route params

ParamTypeDescription
stateRootStateThe root state

LinkProps

Kind: global interface
Properties

NameTypeDescription
namestringRoute name
paramsobjectRoute params

RouteProps

Kind: global interface
Properties

NameTypeDescription
componentComponentThe component to render
startsWithstringRenders the component if the route name starts with this
endsWithstringRenders the component if the route name ends with this
exactstringRenders the component if the route name exactly matches this

buildRouter(routes, config, useListenerPlugin, useBrowserPlugin)

Builds a router with browserPlugin

Kind: global function

ParamTypeDefaultDescription
routesArray.<Route>An array of routes
configOptionsA config object for router5
useListenerPluginbooleanfalseAdd listener plugin
useBrowserPluginbooleantrueAdd browser plugin

routerReducer(state, action) ⇒ RouterState

The reducer of the router module

Kind: global function

ParamTypeDescription
stateRouterStateThe state of router5
actionActionA redux action

onRouteTransition(saga, ...params)

Calls saga with params when router transition succeeds. Provides all the routes to be activated.

Kind: global function

ParamTypeDescription
sagaGeneratorThe saga to be called
...paramsanyThe params to be passed to the saga

onRouteEnter(route, saga, ...params)

Call saga when router transition succeeded on particular route.

Kind: global function

ParamTypeDescription
routestringThe route name to match
sagaGeneratorThe saga to be called
...paramsanyThe params to be passed to the saga

Link(props)

Renders a link

Kind: global function

ParamTypeDescription
propsLinkPropsProperties

Route(props)

Renders a component based on the match with the name of the current route

You have to set exactly one of startsWith, endsWith, or exact prop.

Kind: global function

ParamTypeDescription
propsRoutePropsProperties