To initialize a React project, we can use the create-react-app tool, which sets up the environment for React development, including the following:
- Babel, so that we can use the JSX and ES6 syntaxes
- It even includes language extras beyond ES6, such as the object spread operator, which we are going to make use of later
- Additionally, we could even use TypeScript and Flow syntax
Furthermore, create-react-app sets up the following:
- Autoprefixed Cascading Style Sheets (CSS), so that we do not need browser-specific prefixes such as -webkit
- A fast interactive unit test runner with code coverage reporting
- A live development server, which warns us about common mistakes
- A build script, which bundles JavaScript, CSS, and images for production, including hashes and sourcemaps
- An offline-first service worker and a web app manifest to meet all criteria of a Progressive Web App (PWA)
- Hassle-free updates for all the tools that have been previously listed
As we can see, the create-react-app tool makes React development a lot easier for us. It is the perfect tool for us to use in order to learn about React, as well as for deploying React applications in production.