Skip to content

Instantly share code, notes, and snippets.

@kaylagordon
Last active November 11, 2024 20:58
Show Gist options
  • Save kaylagordon/877bd895f8bf59d228f913b1216aa452 to your computer and use it in GitHub Desktop.
Save kaylagordon/877bd895f8bf59d228f913b1216aa452 to your computer and use it in GitHub Desktop.

Steps to get a React App up and running

Create React App

Create React app:

npx create-react-app NAMEOFYOURAPP

To run your app:

npm start

Cypress (if needed)

Install Cypress:

npm i -D cypress

Next, we need to add a script to our package.json file to run Cypress:

  {
    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      // ...
      "cypress": "cypress open" /* <----- Add this line */
    }
  }

To run Cypress:

npm run cypress

Router (if needed)

Install Router:

npm install react-router-dom

In index.js, wrap your <App /> component in <BrowserRouter />.

Example import:

import { Routes } from 'react-router-dom'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment