Creating React Components
With React, we can build JSX components that can be used as templates. These components can have an internal state, which can be updated, and the update can force a re-render of the component. We can explore the basic outline of the React component by building the create to-do item component. This component takes an input for the title of the to-do item being created and keeps track of the state of the title. When the button is clicked the create component then makes an API call with the title to then create the to-do item, and then returns the updated state to the parent component.
We can start building our create component with the following imports and interface in our CreateItemForm.tsx
file:
// File: ingress/frontend/src/components/CreateItemForm.tsx
import React, { useState } from 'react';
import { createToDoItemCall } from "../api/create";
interface CreateToDoItemProps {
passBackResponse: (response: any) => void;
}
The CreateToDoItemProps...