You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pick useArray as an example, this hook creates a bunch of convenient functions around Array types, it manages a local state by using useState in its implementation:
In real word, we often create states from variant sources, like recoil's useRecoilState, or a abstract [state, setState] passed via Context, then we are not able to create array functions around these states, this is an important missing functionality of a well designed hooks library.
For this reason, we're preparing to split some hooks into 2 parts:
a useSomethingWith([state, setState]) to wrap an existing state tuple
a useSomething hook depending on the previous useSomethingWith with a local state
After this, we can simple introduce useArrayWith to help us manage global arrays like:
Pick
useArray
as an example, this hook creates a bunch of convenient functions aroundArray
types, it manages a local state by usinguseState
in its implementation:In real word, we often create states from variant sources, like
recoil
'suseRecoilState
, or a abstract[state, setState]
passed viaContext
, then we are not able to create array functions around these states, this is an important missing functionality of a well designed hooks library.For this reason, we're preparing to split some hooks into 2 parts:
useSomethingWith([state, setState])
to wrap an existing state tupleuseSomething
hook depending on the previoususeSomethingWith
with a local stateAfter this, we can simple introduce
useArrayWith
to help us manage global arrays like:The text was updated successfully, but these errors were encountered: