github-reason-react-tutorial icon indicating copy to clipboard operation
github-reason-react-tutorial copied to clipboard

How would this work with ReasonReact.SideEffects

Open damienadermann opened this issue 8 years ago • 0 comments

Love the tutorial. However I've been looking around for how to handle side effects properly with reducer components and can't find much information. A scenario being if we had a button that loaded the next page. In js react land you might trigger an action that does a side effect that optionally does a state changes along the way.

The flow would be

  1. dispatch action
  2. reducer doesn't do anthing with action (NoUpdate)
  3. Middleware handles the action allowing for more actions to be dispatched and side effects to fetch data or do some other work

Tools that promote this pattern: -https://github.com/redux-saga/redux-saga -https://github.com/redux-observable/redux-observable

How would you handle doing a side effect from an event, like the click load more example above?

damienadermann avatar Sep 21 '17 07:09 damienadermann