← React Beginner Questions - Set 8 Q71

What is the difference between props and state?

React Beginner Questions - Set 8

Example

function Card({ title, children }) {   // props: from outside
  const [open, setOpen] = useState(true);   // state: owned here
  return open ? <h3>{title}{children}</h3> : null;
}

What to notice

← Back to the question list