Is there a way to access the current state from inside an effect ?
My use case is a saveToRemoteStuff effect that would take a computed value from the state, send it with a POST request and then, when the POST succeed update the state with { dataSaved: true } (or something like this...)
The problem is that I don't have access to the state in my effect 😢
Hi,
Is there a way to access the current state from inside an effect ?
My use case is a
saveToRemoteStuff
effect that would take a computed value from the state, send it with aPOST
request and then, when thePOST
succeed update the state with{ dataSaved: true }
(or something like this...) The problem is that I don't have access to the state in my effect 😢My solution for now is to get computed value in the component and then pass it to the effect but it feels wrong.
Is there any better way to do this kind of things ? Ask me if you need more details :)
Etienne.