react-vite-demo

react and vite demo

git clone https://9o.is/git/react-vite-demo.git

Checkbox.tsx

(296B)


      1 import { useId, memo } from "react"
      2 
      3 export const Checkbox = memo(({ label, name }: { label: string, name: string }) => {
      4     const id = useId()
      5 
      6     return (
      7         <>
      8             <input id={id} name={name} type="checkbox" />
      9             <label htmlFor={id}>{label}</label>
     10         </>
     11     )
     12 })