Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 372 Bytes

use-state.md

File metadata and controls

23 lines (18 loc) · 372 Bytes

@ katopz

Fill in the blank.

import React, { useState } from 'react'

function Example() {
  // Declare a new state variable, which we'll call "count"
  const [____, ____] = ____(0)

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  )
}
  • count
  • setCount
  • useState