Skip to main content

Locations

Routes in the router are configured by creating both a location template and a route configuration object.

Location templates define the path to the route, with any optional parameters.

Example

 ├── ModuleFolder
│ └── components
│ │ └── ModuleNameList.js
│ │ └── ModuleNameShow.js
+│ └── locations.js
src/modules/ModuleFolder/locations.js
export default {
list: createLocationTemplate({
name: 'module-name/list',
path: '/module-name',
}),
show: createLocationTemplate({
name: 'module-name/show',
params: ['id'], // Here you can also set up a dynamic params in route
path: '/module-name/:id',
}),
}

Location templates are used to pass location parameters and query values to navigate and setLocation sagas.

For example...

  const handleListWidgets = value => {
dispatch(navigate(L.Widgets.list(null, query)))
}
  const handleShowWidget = value => {
dispatch(navigate(L.Widgets.show({ id })))
}