Day 14 - Implementing useContext() - REST Countries Part IV

joanne

Joanne

Posted on September 28, 2020

Day 14 - Implementing useContext() - REST Countries Part IV

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.

Dark Mode

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!

example gif for modes

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:

final

Onto the next challenge!

💖 💪 🙅 🚩
joanne
Joanne

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