intendednull / yewdux

Ergonomic state management for Yew applications
https://intendednull.github.io/yewdux/
Apache License 2.0
322 stars 31 forks source link

yewdux for yew-functional: yewdux-functional #3

Closed lukechu10 closed 2 years ago

lukechu10 commented 3 years ago

There should be an official integration with the upcoming functional components. This should probably belong in another yewdux-functional crate because yew itself does not depend on yew-functional.

The API could simply be: use_dispatch<T>() -> Dispatch<T> that subscribes to the store and automatically triggers an update when the store is modified

I would also like to propose making this repo a monorepo containing both yewdux and yewdux-functional like the yew repo.

I can attempt implementing this if it's ok.

intendednull commented 3 years ago

Sounds great! Would love to see it :)

Feel free to setup the workspace as needed.

martin-kolarik commented 3 years ago

As I understand yewdux, there is possibility to create multiple roots = stores = sources of truth, what is a difference compared to Redux. There is a work used in Atlassian, https://atlassian.github.io/react-sweet-state/#/, which nicely combines Redux and React's context into single powerful tool. Yewdux-functional looks similarly to me, including possibility to access store from non-functional components. Is simply sounds great.

I have good experience with this mixed approach, because it allows better separation of concerns -- even global state is frequently better to have it split to pieces.

I'm strongly voting for this, can't wait :-).

zvolin commented 2 years ago

This seems already done in #6

intendednull commented 2 years ago

Think all that's really left here is proper documentation

intendednull commented 2 years ago

yewdux-functional has been merged into yewdux (following Yew's example).