Created
April 4, 2020 09:28
-
-
Save binhtran04/15bcd02c251b8daa7cced3404a13140c to your computer and use it in GitHub Desktop.
Multiple providers
This file contains hidden or 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
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