Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I happen to also have thought about this. Effects would listen to the global state and if needed do their side effect and update the state. As a type it's just State -> State, with an implicit side effect.

As an example: Say the user clicks a button to submit a form, clicking the button updates the local state to include something like `status: 'SUBMIT_REQUESTED'` then you make the request conditionally, and update the state to `status: 'IN_PROGRESS'`.

It might become a mess, but the point is to do no side effects based on any events, all effects happen conditionally based on the state. My hope is the forces you to actually track everything you should be tracking in your state object.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: