2

I'm Using react ,

  1. Intially the user will be in '/page1'
  2. He selects a course from the dropdown and he clicks continue button
  3. he will be redirected to '/page2' , selected course_id is present in page 2 component props
  4. Now what i am trying to do is , when the user clicks back button in the browser he is redirected to '/page1' , but instead i need to '/page1?course=course_id" , so that the course which he has selected initially is now pre-selected..
vamsi
  • 231
  • 2
  • 8
  • Hi could you include a [Minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)? – yudhiesh Oct 29 '20 at 13:34
  • You need to use local storage or redux store. You can set `course_id` in local storage or redux store when you reach page2. In `componentDidMount` of page1, you can get URL from local storage or redux store. – Prime Oct 29 '20 at 13:34
  • https://stackoverflow.com/questions/39342195/intercept-handle-browsers-back-button-in-react-router?noredirect=1&lq=1 Try to intercept the default action – Biswa Soren Oct 29 '20 at 13:36

0 Answers0