0

Is it possible to do this with react router?

<Route path="/:reset_password" component={ResetPassword} />
<Route path="/:create_password" component={CreatePassword}/>

I want use different param with different component. I test above code and it doesn't work. the code above work if I change to this:

<Route path="/something1/:reset_password" component={ResetPassword} />
<Route path="/something2/:create_password" component={CreatePassword}/>

thanks for the help

Dhika
  • 29
  • 1
  • 4
  • 1
    Not sure why you put those as parameters? Why not just `path="/reset_password"` and `path="/create_password"` (without the `:`)? – Chris Jul 18 '16 at 13:20

1 Answers1

0

As @chris said, remove the colons and/or assign dedicated routes. React Router can't differentiate between the two routes you've supplied, as they're technically identical (root path + a dynamic parameter.)

probablyup
  • 7,636
  • 1
  • 27
  • 40