Content
@
0 reply
0 recast
0 reaction
degeneratecall.eth š”
@degeneratecall.eth
1) @frames, CC @stephancill @df I'm diving a bit deeper into some more (complex?) conditional logic. My issue is that, given the scenario below, I'm unable to determine in the reducer when loading pg3 which btn is clicked on pg2, ie `doB` or `doC`, because all I have available is the idx, which is `1` for both/either?
3 replies
0 recast
2 reactions
David Furlong
@df
yeah thats what the state should solve; you should store whatever additional context you need in the reducer state
2 replies
0 recast
0 reaction
David Furlong
@df
for example store `condition` in the state, then you can use that to determine what branch you're on
1 reply
0 recast
0 reaction
degeneratecall.eth š”
@degeneratecall.eth
So then that means all conditional logic, such as API calls etc, need to happen within the reducer itself, given that dispatch is currently not used?
1 reply
0 recast
0 reaction
David Furlong
@df
no, you should do the conditional logic in the render. Dispatch is called automatically between frames. Frames are all server rendered, so the reducer metaphor isn't ideal. Each reducer state transition is actually a new server render
0 reply
0 recast
0 reaction