Help please, I would like to ask why is react state not re-rendering.
the console shows the updated state but not in render.
I have similar code with same scenario, this is just to simplify.
import React, {useState} from "react"; const [x, setX] = useState([1]); const Sample = () => { <div> hello <button onClick={async () => { tempX.push(1); console.log(tempX) await setX(tempX) }}> x </button> {x.map( function(z) {return z})} </div> } export default Sample;