Answers for "get state from history react"

4

history.push with params

import { useHistory } from "react-router-dom";

const FirstPage = props => {
    let history = useHistory();

    const someEventHandler = event => {
       history.push({
           pathname: '/secondpage',
           search: '?query=abc',
           state: { detail: 'some_value' }
       });
    };

};

export default FirstPage;
Posted by: Guest on August-26-2020
4

react router history push parameter

this.props.history.push({
  pathname: '/template',
  search: '?query=abc',
  state: { detail: response.data }
})
Posted by: Guest on March-17-2020
0

how to get state value from history react

history.push({
  pathname: '/path',
  customNameData: yourData,
});
Posted by: Guest on July-28-2020
0

how to get state value from history react

this.props.location.customNameData // it is equal to yourData
Posted by: Guest on July-28-2020
0

how to get state value from history react

history.push('/path', yourData);
Posted by: Guest on July-28-2020

Code answers related to "get state from history react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language