Skip to content

Instantly share code, notes, and snippets.

@binhtran04
Created April 4, 2020 09:28
Show Gist options
  • Save binhtran04/15bcd02c251b8daa7cced3404a13140c to your computer and use it in GitHub Desktop.
Save binhtran04/15bcd02c251b8daa7cced3404a13140c to your computer and use it in GitHub Desktop.
Multiple providers
const App = () => {
return (
<AuthenticationProvider>
<Router>
<Home path="/" />
<UserProfile path="/myProfile" />
<Dashboard path="/dashboard" />
</Router>
</AuthenticationProvider>
)
}
const UserProfile = () => {
const { userId } = useAuthenticationContext()
return (
<UserProvider userId={userId}>
<UserNav />
<UserNotification />
<UserSettings />
</UserProvider>
)
}
const Dashboard = () => {
return (
<DashboardProvider>
<DashboarNav />
<DashboardContent />
</DashboardProvider>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment