Closed piggyman007 closed 5 years ago
shall we setState like native hook?
e.g.,setData(newData) instead of
setData(newData)
setData(v => newData)
Yes, both are possible.
https://github.com/dai-shi/react-hooks-global-state/blob/7b2f10083fe842ed0b44fd6d2a4333efe9126811/examples/01_minimal/src/index.js#L17
https://github.com/dai-shi/react-hooks-global-state/blob/7b2f10083fe842ed0b44fd6d2a4333efe9126811/examples/02_typescript/src/Counter.tsx#L10
Thanks for the response. I have added more example in the readme file, please merge my PR. @dai-shi
Merged. Thanks. Look forward to more feedbacks.
shall we setState like native hook?
e.g.,
setData(newData)
instead ofsetData(v => newData)