richardcrng / redux-leaves

Write once. Reduce anywhere.
https://redux-leaves.js.org
50 stars 4 forks source link

Create examples which show usage with React components #180

Open CarlMungazi opened 4 years ago

CarlMungazi commented 4 years ago

Do you have any plans to create examples which show how this can be used with a typical React application? I started experimenting with the project today and realised there was a no quick reference which shows how you would wire this up to an existing React application.

richardcrng commented 4 years ago

Thanks @CarlMungazi! Great question - this is definitely something that will be useful.

As per my comment in your useReducer issue, I will be supporting Riduce rather than Redux-Leaves (same API, significant refactor, different branding) but I definitely do intend to do more comprehensive React examples for that.

Here's one React example for Riduce. It's very small.

The recipe for larger apps would be basically the same as a useReducer + useContext recipe, e.g.:

where the job of Riduce (or Redux-Leaves) is to replace the reducer, but otherwise it's exactly the same.

At some point, I might build a useRiduce hook of some sort, but it's not an immediate priority.

Does that help, or is there anything I should try to clarify?

CarlMungazi commented 4 years ago

No, that's pretty clear. When I migrate to the new lib I will hit you up if I get stuck.