问题
I am trying to redirect a page using React upon a setTimeOut. Still new to developing in general and very new to React so I'm a bit lost. Below is what I have so far...
componentDidMount() {
setTimeout(() => {
???????????('/')
}, 1000)
}
回答1:
managed to figure it out.
componentWillMount(){
setTimeout(() => {
this.props.history.push('/');
}, 5000)
}
来源:https://stackoverflow.com/questions/55399379/react-redirect-page-on-timeout