mrmilu / react.base

Mr Milú's official starter template for React.js projects.
5 stars 0 forks source link

Feature/11 zustand with provider #12

Closed arnaugomez closed 1 year ago

arnaugomez commented 1 year ago

Closes #11

Zustand by itself does not support providers and autodispose out of the box. But I have found a way to make it work without extra depenencies.

The logic is inside the zustandWithProvider function. It returns a hook that lets you access the state, and a Provider component.

I suggest to create an npm package with the zustandWithProvider utility function, because I have not found any npm package like this and it is very useful.

hazzo commented 1 year ago

Updated branch removing redux toolkit entirely and updating almost every dependency.