React useState with Callback

1 · Robin Wieruch · June 3, 2019, 1:52 a.m.
If you have started to use React’s useState hook for your application, you may be missing a callback function, because only the initial state can be passed to the hook. In React class components, the setState method offers an optional second argument to pass a callback function. However, this second argument isn’t available for React’s useState hook. If you are moving from React class components to function components, this may be a concern for you....