Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created March 21, 2018 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/791399073c7fa19c828ce9e9abb85bfc to your computer and use it in GitHub Desktop.
Save uno-de-piera/791399073c7fa19c828ce9e9abb85bfc to your computer and use it in GitHub Desktop.
class MyComponent extends React.Component {
state = {
redirect: false
}
handleSubmit () {
axios.get(url)
.then(() => this.setState({ redirect: true }));
}
render () {
const { redirect } = this.state;
if (redirect) {
return <Redirect to='/login' />;
}
return <div>Contenido component</div>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment