- When setting a state (
useState
), it'll only re-renders if the value changed. - When setting multiple states at once, we'll only trigger one re-renders if it happens inside a hook callback (previously each state change triggered one re-render.)
If you're setting multiple state in a callback from an async function (like setTimeout
or a network call), those will not be merged in a single re-renders. For those case, you're better using a state object holding all values to reduce the amount of re-renders. Open to discuss this in #1251