Introduction to React
In this section of the chapter, we will set up a React development environment, and explore the JSX syntax that React uses. We will also discuss how parent components pass information to child components through properties, or props, and how a component can track its own properties through what is known as React state.
React setup
Setting up a React development environment has, in the past, been a rather time-consuming and delicate operation. Getting React to work properly with TypeScript in the past only seemed to add to this complexity. The React community, however, has introduced a set of handy utilities to make setting up a React development environment a breeze.
We can create a fully fledged React application, complete with unit testing and TypeScript integration, by running the following command:
npx create-react-app product-list --template typescript
Here, we are running the create-react-app
script directly with npx
, instead of installing...