How I can use BrowserRouter in React correctly?

I’m creating a React project and I want to implement the BrowserRouter but the problem is that when I used it, it always throw the React Error of:

***Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.***

I don’t know what is this about, because as far as I know, I’m not using hooks and I read the documentation and other tutorials to solve this problem (like deleting double react or npm link and that’s stuff) but this still a problem.

Here are my files.

App.js

import { BrowserRouter, Route, Routes, Link } from "react-router-dom";

import Navbar from "./components/navbar"
import Login from "./components/login";
// import CreateExercise from "./components/create-exercise.component";
// import CreateUser from "./components/create-user.component";

function App() {
  return (
    // <h1>HOASNKFNLSA</h1>
    // <div>
    //   <Home/>
    
    // </div>
    <BrowserRouter>
      <Routes>
      <Route path="/" render={() => {
      <h1>HOKAKSFNAKSO</h1>
    }}>

    </Route>
    </Routes>
    </BrowserRouter>
    
    
    
  );
}

function Home() {
  return (
    <div className="container text-center"> 
      <h1>KEVIN STYLE PELUQUERIA</h1>
      
    </div>
  );
}

function About() {
  return (
    <div>
      <h2>About</h2>
    </div>
  );
}

function Dashboard() {
  return (
    <div>
      <h2>Dashboard</h2>
    </div>
  );
}

export default App;

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);


reportWebVitals();

package.json

{
  "name": "kevin-style-peluqueria",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I don’t know if you need anything else, but if you do, ask me in comments. If you need to know more extra info, I’m not using webpack. I’m using the classic React structure application when you do the command npx create-react-app. I’m also using express and MongoDB like my backend (basically I’m creating an application with the MERN Stack).