cssinjs / theming

Unified CSSinJS theming solution for React
300 stars 39 forks source link

Hook to update theme #116

Open ilan-schemoul opened 2 years ago

ilan-schemoul commented 2 years ago

Would you consider adding an hook to update the theme ?

kof commented 2 years ago

I don’t see why you need one. You can pass a new theme object to ThemeProvider and it will rerender.

On 16. Oct 2021, at 15:04, Ilan Schemoul @.***> wrote:

Would you consider adding an hook to update the theme ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cssinjs/theming/issues/116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAM4WFVTF3Y7KTFYHDDTQDUHFS5JANCNFSM5GDSNKVQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ilan-schemoul commented 2 years ago

But then I need to manually add my own provider to be able to update the state of the "theme" object of Theme provider from child components. Don't I ? I feel like it would be simpler to have a single provider. But maybe it's not a good idea ?

kof commented 2 years ago

I am guessing if you are able to change the theme, you also have logic to do so, meaning you already have a parent component that renders the ThemeProvider and it can use state to set the theme

On 16. Oct 2021, at 21:49, Ilan Schemoul @.***> wrote:

But then I need to manually add my own provider to be able to update the state of the "theme" object of Theme provider from child components. Don't I ? I feel like it would be simpler to have a single provider. But maybe it's not a good idea ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cssinjs/theming/issues/116#issuecomment-944981628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAM4WFB3KWPUAJTMRSB2M3UHHCK7ANCNFSM5GDSNKVQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.