Project overview:
Project shows: Each functional component has its own file. Reacts ‘useState(…)’ hook is used to define and manipulate props for both the App and its child components. The parent App() accesses child state props through event handlers that it passes to its child components, when the child components calls the event handler they can pass their state props into the function. This is known as lifting state up.
The parent App() exposes itself to the DOM (index.js) through ‘export default function App() {…}’. Child component files expose themselves to the parent using the same ‘export default function Child()’ convention. The App() uses the ‘handle…’ naming convention for all event handlers it passes to its child components.
– The child components file ‘Form.js’ contains ‘export default function Form({ onAddItems }) {…’ which uses:
<form className=“add-form” onSubmit={handleSubmit}> where:
Similar ‘handle…()’ event handlers are passed from the parent to child components like:
Code: