Create React App on Netlify

Create React App is a command line tool that generates a boilerplate React single-page application with a pre-configured build pipeline. It simplifies the complexity of setting up a React project, allowing you to focus on building out the app itself.

# Key features

These features provide important benefits for Create React App projects, including ones built and deployed with Netlify.

  • Simplified project setup. You can use create-react-app commands to set up a project with build tools like webpack without the need to configure default settings.
  • Modern TypeScript and JavaScript ecosystem support. You can develop your Create React App project with TypeScript. Create React App also supports a superset of the latest JavaScript standard, including ES6 syntax and certain ES2016 and later features, including async/await, Object rest/spread properties, and dynamic imports.

# Netlify integration

When you link a repository for a project, Netlify tries to detect the framework your site is using. If your site is built with Create React App, Netlify provides a suggested build command and publish directory: react-scripts build and build. If you’re using the Netlify CLI to run Netlify Dev for a local development environment, Netlify also suggests a dev command and port: react-scripts start and 3000. You can override suggested values or set them in a configuration file instead, but automatic framework detection may help simplify the process of setting up a project with Create React App on Netlify.

For manual configuration, check out the typical build settings for Create React App.

# Environment variables

Environment variables prefixed with REACT_APP_ are processed and made available in the browser for client-side JavaScript access. For more information on how to use environment variables in React, check out the Environment variables and frameworks doc.

# More resources