const onDrawerClose = () => {
setCloseDrawer1(false);
setCloseDrawer2(false);
setData(null);
};
When some fields in the data are empty I show error message. It works good but when I close the sidebar, while it's closing I can see for 1second or so this error message since here in the code above we set data to null, how I can properly run the third setState after the previous two are completed?