Create App React Frontend - iff133/first GitHub Wiki

Create React App

  • yarn create react-app app
  • cd app/
  • yarn start
  • go to port 3000 - the app should be running

https://create-react-app.dev/docs/getting-started/

Add required packages

Setting up jest to test react

https://jestjs.io/docs/getting-started

  • yarn add --dev jest
  • Generate a basic configuration file: jest --init
  • Running from command line: yarn jest --notify --config ./jest.config.js
  • Additional Configuration:
    • Using Babel:
      • yarn add --dev babel-jest @babel/core @babel/preset-env

      • Configure Babel to target your current version of Node by creating a babel.config.js file in the root of your project:

        module.exports = {
            presets: [
                ["@babel/preset-env", { targets: { node: "current" } }],
                "@babel/preset-react",
            ],
        };
        

Update NODE JS

When installing some of the yarn dependencies an error kept showing up: node engine requires v>=12 but got v>=10.0.8 which prevented installations of these packages. In order to fix this the node js engine had to be updated.

I followed Option 2 here: https://phoenixnap.com/kb/update-node-js-version

  1. First, clear the npm cache:
    • sudo npm cache clean -f
  2. Install n, Node’s version manager:
    • sudo npm install -g n
  3. Install the latest stable version:
    • sudo n stable
  4. Run:
    • PATH="$PATH"
⚠️ **GitHub.com Fallback** ⚠️