4 ms·
I'm not sure I understand. Which two hooks would be called in this case? In the original example I'm seeing where there's anything atomic involved across multip
by steve_adams_86 5y ago
I'm not sure I understand. Which two hooks would be called in this case? In the original example I'm seeing where there's anything atomic involved across multiple hooks.
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.
- jakelazaroff 5y agoI’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.