-
Book Overview & Buying
-
Table Of Contents
Rust Web Programming - Third Edition
By :
With React, we can build JSX/TSX components that can be used as templates. These are essentially functions that render HTML with the aid of JavaScript or TypeScript. For instance, if we have a list of items, components enable us to loop through that list of items in JavaScript/TypeScript and render the HTML for those items. These components support internal state; updating the internal state can force a re-render of the component.
We will 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 create button is clicked, the create component then makes an API call with the title to create the to-do item and then returns the updated state to the parent component. We can house our components in the frontend/src/components/ directory. Let’s create that now. To build our create item form...