Skip to content

[Bug]: TypeError: Cannot read properties of undefined (reading 'location') #7986

@advrxh

Description

@advrxh

What version of React Router are you using?

^5.2.1

Steps to Reproduce

import "./App.css";

import { useEffect, useState } from "react";

import { Router, Route, Switch } from "react-router";

function Hello() {
  return <div>HEllo</div>;
}

function App() {
  return (
    <Router>
      <Switch>
        <Route path="/about" component={<Hello />} />
      </Switch>
    </Router>
  );
}

export default App;

Expected Behavior

I just wrote the above code and this error is repeatedly showing up.
image

Actual Behavior

There shouldn't be an error by the tutorial I'm following!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions