Props1 / 12
Up next

Destructuring props

interface LabelProps {
  text: string;
  htmlFor: string;
}

// destructure the fields you need
function Label({ text, htmlFor }: LabelProps) {
  return <label htmlFor={htmlFor}>{text}</label>;
}

export default Label;
What you're solving

destructure props in the parameter list