0

I want to implement night mode in an application. So what I am trying is to update state and global variable at a time when night mode is off and on. But right now its updating current screen only using updating of a state.

So the question is how do I create a global variable that reflect the night mode change in whole application? Means updating global variable and reflect it to each and every screen without reloading the app.

Also please suggest me if there is any alternative.

Kirankumar Dafda
  • 2,354
  • 5
  • 29
  • 56
  • 2
    I'd read up on react [context](https://reactjs.org/docs/context.html) and [redux](https://redux.js.org/basics/usage-with-react). Either of these could solve your problem – LLai Dec 13 '18 at 06:23
  • thanks for the reply @LLai , I will try context into this. May be I'll get what I want through it. So will update you once I am done. – Kirankumar Dafda Dec 13 '18 at 07:14

0 Answers0