intendednull / yewdux

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

Documentation: Clarify how the store can be accessed outside of a yew component #65

Closed christophbeberweil closed 9 months ago

christophbeberweil commented 10 months ago

Hi there,

I am learning rust since about a year and yew/yewdux since a few weeks in my free time. One thing that took a lot of time and quite some help from the discord community was to figure out how to access the state in rust code that is not a yew component, so use_state() does not yield the state and dispatch, but a Hook instead.

Acually, the solution is in the documentation, but I have read it a lot of times but simply did not understand it correctly, and I focussed on use_state or alternatives instead.

I'd like to add a small change to the documentation in order to emphasize that

Dispatch::<Counter>::new();

can be used to access the dispatcher and the state from anywhere :)

christophbeberweil commented 9 months ago

Thanks for merging :)