score:0

Accepted answer
const toggleDrawer = false;

          useEffect(() => {   // update variable
            checkDrawOpened(toggleDrawer)
          }, toggleDrawer);]

With the one click

onClick={toggleDrawer}  // use variable

score:0

onClick={toggleDrawer}

Related Query

More Query from same tag