I've wrote a short article about handling inner Re...
# javascript
a
I've wrote a short article about handling inner React state from outside with coroutines: https://medium.com/@altavir/taming-react-with-kotlin-js-and-coroutines-ef0d3f72b3ea. Several people asked me why not use redux. In my particular case it won't work but wanted to ask the backward question (just for understanding it better): does redux do something that is not possible with channel?
👍 3
v
Hi, thanks for sharing your approach!
However, it looks a little bit non-react way, as state is supposed to be used only to keep internal changes
I'm not sure why you need to propagate changes to state if it's possible to pass them as props
Maybe I'm missing something
a
Well, we had a long discussion with the people, who are using react (in russian telegram chat), they also said that the solution is not quite rect-ish. Still, it has one important feature, the inner state is recreated each time new render with propertiese is done, so it you want to control only small aspect of your compoment and leave everething else unchanged, you can't do it by passing new parameters. I think that it could be done more reactish by storing state externally, modifying it from the channel and redrawing component on each
receive
.