Last active
January 30, 2019 02:19
-
-
Save sdymj84/686ec0fe9080a3294a34ba720b49c516 to your computer and use it in GitHub Desktop.
Components that needs to be blocked
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Redirect } from 'react-router-dom' | |
// in function or class's render() : | |
const uid = this.props.uid | |
if (!uid) { | |
return <Redirect to='/' /> | |
} | |
// below component class or function | |
const mapStateToProps = (state) => { | |
return { | |
uid: state.firebase.auth.uid | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment