The NewLesson component

In each course, while it is still unpublished, the instructor will be able to add a lesson by filling out a form. In order to implement this form view to add new lessons, we will create a React component called NewLesson, which will be added to the Course component. This component will render the following form in a dialog box in the Course page:

While defining the NewLesson component, we will first initialize the form values in the state with the useState hook. This component will also receive props from the Course component, as shown in the following code.

mern-classroom/client/course/NewLesson.js

export default function ...

Get Full-Stack React Projects - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.