@k-ramel/driver-redux-little-router

1.2.0 • Public • Published

@k-ramel/driver-redux-little-router

redux-little-router driver for k-ramel

Examples

In a reaction (See main documentation about listeners/reactions)

Declare it in your store :

import driver from '@k-ramel/driver-redux-little-router'

const router = driver({ routes }, state => state.router, 'router')

createStore(
  {
    // your usual definition
  },
  {
    drivers: { router },
  },
)

In your reaction :

export const onUserLoggedIn = (store, action, drivers) => {
  const { router } = drivers
  // get userId in route params
  const userId = router.getRouteParam('userId')
  // dispatch push action to go to the new route
  router.push(`/user/${userId}`)
}

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i @k-ramel/driver-redux-little-router

    Weekly Downloads

    1

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    6.11 kB

    Total Files

    5

    Last publish

    Collaborators

    • fabienjuif
    • guillaumecrespel