Mujtaba Kably
Mujtaba Kably

Reputation: 755

React view isn't getting updated even after redux store is being upated

After the page load the changes to the store are not being captured by the react, but if i make any changes to the any of the reducer files after a live-reload the entire page starts working, but if i reload the page the becomes the same and store updates stop being rendered.

i have tried a lot of things already, diffrent store configuarations, different methods of getting store values namely connect and useSelector.

i have checked dispatch and stores with logs they are working fine, selectors seem not be the issue as well.

I have wasted more than 4 hours on something that i was supposed to take 30mins, any help would be nice to catch whatever i am missing.

link to code sandbox sample here, https://codesandbox.io/s/confident-oskar-30ow2z?file=/src/App.js

Upvotes: 0

Views: 135

Answers (1)

user12086023
user12086023

Reputation:

there appears to be some issue with using StrictMode and ReactDOMClient.createRoot. Perhaps you could remove the strict mode in index.js or just use ReactDOM.render. I tried with your sandbox removing the strict mode and it appears to be working fine. Here is the updated sandbox - https://codesandbox.io/s/modern-sun-6u5icq?file=/src/index.js

Upvotes: 1

Related Questions