Wiki

Clone wiki

DevFecta Public Repository / React

React with PHP Environment Setup

Windows

  1. Install Node.js and NPM by going to nodejs.org to download the latest version.
  2. Open Node.js Command Prompt application that was installed.
  3. Run the command npm install -g create-react-app
  4. Run the command npx create-react-app <name of project>

This will create a folder for the project, and create files and folders for the project.

Linux

npm init react-app <project folder name>

Modify package.json File

Before you build the project make sure to add a value for homepage to the package.json file in the root folder of the project. This will allow you to run the web app without running 'npm start'.

"homepage": "./",

Build Project

This will run 'react-scripts build' and copy minimized files from the 'src' folder to the 'build' folder which can then be copied to a server.

npm run build

Test Project

This will run 'react-scripts test' to test the scripts.

npm test

ESLint TypeScript Dependencies

npm i @typescript-eslint/eslint-plugin --save-dev
npm install @typescript-eslint/parser --save-dev


npm install tsutils --save-dev

Updated