Menu
React Context
-
Theming -> use the Theme context to style App.js
-
Add a Toogle button to the upper left corner
-
When clicking this button, update the value of the ThemeContext.
-
Create a new context called
UserContext
, it's first value will be:{ username: undefined, isLoggedIn: false }
-
Update your
App.js
main component to become a Provider for theUserContext
that you defined -
Create a new Component:
UserProfile
simply displaying the username fromUserContext
-
Update the
onSubmit
method of yourLoginForm
, to update the user's status (first check if username and password are correct, then updateisLoggedIn
accordingly) -
Render your
UserProfile
component instead ofLoginForm
when theisLoggedIn
is truthy.
React Suspense and React.Lazy
- Use
React.lazy
to split yourLoginForm
andUserProfile
components - Create an
ImageLoading
component, which shall display./src/images/dale-waiting.gif
- Use
Suspense
to display<ImageLoading />
while the app is loading your splitted components.