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
Hi,
I have React 17 and I am using hooks. I believe answer is hinted by "Multiple updates inside event handlers get batched into a single update." ... https://reactjs.org/docs/implementation-notes.html#what-we-left-out , but I am not 100% sure I understand it correctly.
Does React guarantee that while my event handler is being processed no re-render happens? That is first re-render happens after my event handler exits.
const onClick = () => {
setState1(1);
// do some stuff
setState1(2);
// do some stuff
setState4(4);
// no-rerender will ever be called by React until this point (that is until function returns) ???
// re-render is only scheduled to happen ASAP
}
Thanks for answering :)
The text was updated successfully, but these errors were encountered:
Hi,
I have React 17 and I am using hooks. I believe answer is hinted by "Multiple updates inside event handlers get batched into a single update." ... https://reactjs.org/docs/implementation-notes.html#what-we-left-out , but I am not 100% sure I understand it correctly.
Does React guarantee that while my event handler is being processed no re-render happens? That is first re-render happens after my event handler exits.
Thanks for answering :)
The text was updated successfully, but these errors were encountered: