Skip to content

Access match object in reducer #38

@joaosoares

Description

@joaosoares

It doesn't seem like it is possible to access the match object in the reducer. Should there be a way to connect a specific Route so that its state is saved to the reducer as well? Something like

import { ConnectedRouter, ConnectedRoute } from 'connected-react-router'
...
<ConnectedRouter history={history}>
  <ConnectedRoute path='/example/:willshow' />
  <Route path='/example/:wontshow' />
</ConnectedRouter>

that would generate the state

{
  history: {
    location: {
      path: '/example/somevalue'
    }
  },
  match: {
    params: {
      willshow: 'somevalue'
    },
    // ... React-Router match object (from https://reacttraining.com/react-router/#match)
  }
} 

This would basically make the reducer state be the same as the Router object received from the withRouter connector.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions