brunocodutra / reducer

A predictable reactive framework for Rust apps inspired by Redux
https://crates.io/crates/reducer
MIT License
58 stars 1 forks source link

Action composition? #201

Open etodanik opened 11 months ago

etodanik commented 11 months ago

In the JS-land Redux, one of the convenient things is having various patterns that allow you to dispatch actions based on actions dispatched. e.g thunks and more complex concepts like rx , sagas, epics in an asynchronous way that involves side effects. What would be the equivalent here?

brunocodutra commented 10 months ago

Hey Danny, could you give me a concrete example of what you would like to achieve?

etodanik commented 10 months ago

At the very minimum, side effects in UI. e.g: Launch an action that triggers an async function , respond with dispatching error/success actions.

brunocodutra commented 10 months ago

And how is this usually accomplished? I guess an interceptor between dispatchers and reducers that filter out "fake" actions and trigger side effects? You could do this by implementing trait Reducer for some type that wraps your actual state. The library doesn't currently provide any convenience utilities for this though :(