DEV Community

Cover image for Coding a Toggle switch with React.js and Material UI
Bek Brace
Bek Brace

Posted on

Coding a Toggle switch with React.js and Material UI

Hey coders🤓 hope you're having an amazing day.

I enjoy coding and learning, especially when I know that I can share my experience with my friends on the internet, so that's why I have coded this very simple minimalist home page with React and Material UI, but I guess what I wanted to achieve is creating a toggle switch for light and dark mode, something that you can see now in modern websites for readers who prefer to not be bothered by the flashing light - like myself - so this switch provides the option to change the page's color to black and font automatically is converted to white.

I think it's cool, and even cooler to know how you can do it in react, I did not create a component as this was the only component in the app, usually i create components when I have more than one element I want to integrate them; but you can optimize the code as you like.

This is the video, and I hope you will enjoy it 🙂

Follow me on twitter and Instagram : @ BekBrace

Join my Facebook page : @bekbraceinc

Top comments (0)