Open CaptainN opened 3 years ago
@CaptainN how can we help here?
This just needs documentation and tests. (Or an executive decision to skip those)
~This useId hook has the potential to make this a full blown meteor flavored replacement for useState
. I might even be inclined to provide one for useReducer
as well.~ (Er maybe not? I think I jumped the gun. The ID it generates would not survive a reload.... nm)
How would it be an example of the use of this? I could probably try to help to test, but creating a good readme is an easy win. Do you have an example of using this custom hook?
It's almost the same as using useState
except you need to name the object with a globally unique string. You would use this for something like form input - then when the page refreshes due to a meteor refresh, that data should be restored. That would work through both development refreshes and during hot-code pushes.
Have been using this in production for over two years now without a problem. Let's get this finished please!
This adds the
react-meteor-state
package! This package contains theuseMeteorState
hook, which provides a state manager like React's build inuseState
built on Meteor'sReload
package. The result, state persists between page refreshes during development and hot-code-push!The only downside is that you have to name each use with a globally unique name - so this is not a direct replacement for
useState
.TODO: