Answers for "React useState vs variable"

0

React useState vs variable

function Foo() {
    const [a, setA] = useState(0);
    return <div onClick={() => setA(a + 1)}>{a}</div>;
}

function Foo() {
    let a = 0;
    return <div onClick={() => a + 1}>{a}</div>;
}
Posted by: Guest on July-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language