skip to Main Content

I am dealing with react useContext and I and not able to update my golbal state value in each and every screen.

I am trying to change my theam color in App but it is reflect in that screen from where I change but when I navigate to another Screen I am not able to to see the change only default value is passing.

please help me with this.

I have tried to update my value and pass the value but I am not able to update it only shown in the same screen from where I have the feature of change theam color. but in another screen the change is not reflected.

2

Answers


  1. The react office documentation provides a clear explanation of useContext and how to implement it for the use-case you asked. Check this

    Login or Signup to reply.
  2. I suggest using a State Management library, like Redux Toolkit. It is easy to understand and also will help you store and update the state of the application.

    I didn’t use useContext much but maybe you need to check if this is happening only in one use-case – the one you described – or there is a general problem inside the app

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search