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
As we already know, the Dispatch function from the useState hook accept a function as an async dispatcher. So, we can't pass a function into this dispatcher as expected. Example:
const[callback,setCallback]=useState<()=>void>();// thensetCallback(()=>doSomething());// ❌ we can't do this, as the returned value of `doSomething` will be pass into the `callback` value.
Solution
We need to pass a function that returns a function that returns a function 😂
Problem
As we already know, the Dispatch function from the
useState
hook accept a function as an async dispatcher. So, we can't pass a function into this dispatcher as expected. Example:Solution
We need to pass a function that returns a function that returns a function 😂
The text was updated successfully, but these errors were encountered: