Day 14 - Implementing useContext() - REST Countries Part IV
Joanne
Posted on September 28, 2020
The project guidelines required an implementation of dark and light modes for better visibility in different environments. This can be easily achieved by creating a state that can indicates what mode the application is set to and passing this mode state down as props to child components. A more efficient way to do this is to use context.
What I Learned
I already knew how to create context and use providers and consumers in React. But this was my second time using the useContext() hook and discovered it was much easier to implement!
How This Will Help Me
This project actually helped me get better with how styles and context can work together in achieving dynamic looks. And with the completion of this element, I completed the REST countries application and ended up with this:
Onto the next challenge!
Posted on September 28, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024