Attempted import error: ‘Outlet’ is not exported from ‘react-router-dom’

  outlet, react-router, reactjs

Please help me on how I can fix this error

Attempted import error: 'Outlet' is not exported from 'react-router-dom'.

This is how I imported the component

import { Outlet  } from "react-router-dom";

This is my Package.json file

"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.11.0",
"react-router-dom": "^5.2.0",
"react-router-hash-link": "^2.0.0",
"react-scripts": "3.4.3",
"serve": "11.3.2"
},

This is where I’m trying to use it

const User = () => {
  return (
    <div className="User">
      <TopNav />
      <SideNav />
      <div className="Body">
        <Outlet />
      </div>
    </div>
  );
};

Source: React Router Questions

One Reply to “Attempted import error: ‘Outlet’ is not exported from ‘react-router-dom’”

LEAVE A COMMENT