DEV Community

Discussion on: No Fuss Dark-Mode Toggle with React & Styled-Components! πŸŒžβ†”οΈπŸŒ–

Collapse
 
midorun profile image
Dmitriy Vorozheykin • Edited

Hey, Chris, did you know that u have no need to pass theme prop to each component?
Look for ThemeProvider component from styled-components, it gives you opportunity to wrap you whole JSX component with provider which will pass theme prop to all styleds via context, so u will need to pass your theme only to themeProvider

Collapse
 
hyggedev profile image
Chris Hansen

Absolutely! I wanted to make this as easy as possible! But you are the second person to mention this, so I think I'm just gonna have to continue this, possibly as a series! May have to give that a shot πŸ˜… Thanks for your input, it is good advice 🀘