passing data in react router history,push
this.props.history.push({
pathname: '/template',
search: '?query=abc',
state: { detail: response.data }
})
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;
this.props.location.state.detail
<Link to={{
pathname: '/template',
search: '?query=abc',
state: { detail: response.data }
}}> My Link </Link>
<Link to={{ pathname: "/register", state: data_you_need_to_pass }}> Register</Link>
Also in JavaScript:
- js hangman with repeated characters
- get the whole value of a number javascript
- vowel
- jquery loop through list element
- get textarea value jquery
- install vue-cli
- sars
- parse local json file
- downloadable custom pdf for node
- react proptypes example
- node js util promisify
- javascript do arrays intersect
- tomodachi
- js outputting data
- Sum of all the multiples of 3 or 5
- javascript program to find leap years between two years
- js check if object is empty
- sequelize get where
- webpack css not shoud be empty
- react native add custom fonts
- reverse number in js
- get random element from string array java
- usestate redux
- Javascript measure function run time