Redux with next js
Answered
Great golden digger wasp posted this in #help-forum
Great golden digger waspOP
I have store.js Provider.js which are both client component and Provider.js is wrapped around layout.js which makes the redux work on client side. I wanted to know how can i get access to store state in server components ?
as we know we can't use hooks in server side, I tried to use store.getState() function but it throws an error that .getState is not a function
as we know we can't use hooks in server side, I tried to use store.getState() function but it throws an error that .getState is not a function
Answered by Rafael Almeida
server components can't read the data from the normal Context API, so this is not possible
4 Replies
server components can't read the data from the normal Context API, so this is not possible
Answer
what exactly are you trying to read? if you are populating the redux store with data from another RSC, you could also read this data in the same way in the other RSC down the tree
Great golden digger waspOP
ook got it now clear and staight thanks @Rafael Almeida
thanks for helping me out