1

In this example below:

  const [course, setCourse] = useState({
    id: null,
    slug: "",
    title: "",
    authorId: null,
    category: "",
  });
  function handleTitleChange(e) {
    setCourse({
      ...course,
      title: e.target.value,
    });
  }

How React know to update title state value, and don't touch other?

If I make copy from the state in course why is here no error? course.title exist or not? And how I update him only post bellow his name?

Is this a React system or a JavaScript system?

Thanks!

Milos N.
  • 4,416
  • 6
  • 18
  • 31

0 Answers0