Dup Ver Goto 📝

useState

PT2/webdev/react/basics does not exist
To
33 lines, 88 words, 672 chars Page 'useState' does not exist.

See the official docs

const [state, setState] = useState(initialState)

now you must call useState in the same order.

function example() {
  const [ count, setCount ] = useState(0)
}

function App() {
  const [ count, setCount ] = useState(0)
  function handleChangeCount() {
    setCount(1)
  }
}

combining with EventHandler's

function App() {
  const [ x, setX ] = useState("")
  const [ y, setY ] = useState(0)
  const handleMrFlibble = e => {
    setX(e.target.textContent)
    setY(y+1)
  }
  return (
    <Main>
      <MyButton onClick={handleMrFlibble}>Fry</MyButton>
    </Main>
  )
}