setter1.tsx
setter2.tsx
1
import { useState } from "react"
2
3
export function AirplaneModeToggle() {
4
const [toggle, setToggle] = useState(false)
5
return <>
6
<div>{ toggle }</div>
7
<button onClick={ () => setToggle(true) }>Turn On</button>
8
<button onClick={ () => setToggle(false) }>Turn Off</button>
9
</>
10
}
localhost:3000
false