delboud delboud - 1 year ago 96
React JSX Question

Any way to get current params outside a component

Is it possible to get the params outside of a component props?

In my case I want handle navigation inside some action creators (with redux).

Answer Source

Let's say that you connected the action createUser to your component ok?

So from your component you are going to do this:

this.props.createUser(this.props.username, this.props.password)

And finally this is going to be your action dispatcher:

export const createUser = (username, password) => {
  return (dispatch,getState) => {
      type: CREATE_USER,
      username: username