1state = { redirect: null };
2
3render() {
4 if (this.state.redirect) {
5 return <Redirect to={this.state.redirect} />
6 }
7 return(
8 // Your Code goes here
9 )
10}
11
12// update the redirect
13 this.setState({ redirect: "/someRoute" });
1state = { redirect: null };
2render() {
3 if (this.state.redirect) {
4 return <Redirect to={this.state.redirect} />
5 }
6 return(
7 // Your Code goes here
8 )
9}
10