Create React app:
npx create-react-app NAMEOFYOURAPP
To run your app:
npm start
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
Install Router:
npm install react-router-dom
In index.js
, wrap your <App />
component in <BrowserRouter />
.
Example import:
import { Routes } from 'react-router-dom'