Re:Two custom React hooks
by jakelazaroff on Saturday December 18, 2021 @01:10AM
(#29602158)
Iām saying that if you have multiple pieces of state that must be updated atomically, it makes sense to store them in an object in one useState hook because it signals to other developers that they should be updated together. The fact that React allows you to batch the renders if you store the state in two separate hooks is unimportant.
Are you referring to the usePromise and useAsyncExtendedState? If so, it's okay to use those hooks independently. They work fine without each other, but they also work well together.