keshidong / react-use-that

Basic and powful react hooks
5 stars 0 forks source link

feat: Improve the useState hook function #6

Open keshidong opened 5 years ago

keshidong commented 5 years ago

useState hook's the second return value that similar with setState, hereinafter referred to as hook/setState

In some cases, we need to do something after the didUpdate triggering by hook/setState. So I recommend hook/setState to return Promise type value after execution.

keshidong commented 5 years ago

Rename the hook useState to useStateCallback. The improved useState with this feature can be renamed with useStatePromise.