4

I'm using react router version 2.0.1 for navigation between components. I came across a scenario where i want dynamically navigate to other component I did something like this for redirection

browserHistory.push("/some/path");

It is navigating to other component perfectly. But i also want to pass some parameters along with the redirection. I tried doing it like

browserHistory.push("/some/path", {query: "param1"});
browserHistory.push("/some/path", {query: {param1: value1}});

But when i try to fetch the value from this.props.location it shows blank query result.

Any suggestions would be greatly appreciated.

3

1 Answer 1

4

This shuld work for you:

router.push({
  pathname: '/some/path',
  query: { param1: value1 } 
})

or I've seen people doing this and looks like its workin ok:

browserHistory.push("/some/path?param1=value1");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.