'React updateing states

i am trying to create a reSize for my pixel art grid the problem is that setSize is not ready yet when i am rendering location i'm in do you know how can i deley setOcells till its done?

const reSize = (e) =>{
    console.log(e.deltaY)
    var newSize = size+e.deltaY
      if (newSize>=10 && newSize<101) {
        setSize(newSize)
      }  
      if (newSize<10){
        setSize(10)
      }
      if (newSize>100){
        setSize(100)
      }
      setOCells(renderLocation(location[0],location[1]));
    
      setCells(oCells);
      setChanges([]);
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source