Skip to content

Instantly share code, notes, and snippets.

@sdymj84
Last active January 30, 2019 02:19
Show Gist options
  • Save sdymj84/686ec0fe9080a3294a34ba720b49c516 to your computer and use it in GitHub Desktop.
Save sdymj84/686ec0fe9080a3294a34ba720b49c516 to your computer and use it in GitHub Desktop.
Components that needs to be blocked
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