remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
52.89k stars 10.24k forks source link

[Bug]: Link when used with Outlet is not working. It is routing to error page when clicked. #11781

Closed ashwiniraj096 closed 2 months ago

ashwiniraj096 commented 3 months ago

What version of React Router are you using?

6.24.1

Steps to Reproduce

Following along with the Tutorial. Client side routing made with Link element in root.jsx causing issue.

Expected Behavior

contacts/:id URL should load Contact Page

Actual Behavior

contacts/:id URL is routed to Error Page instead of Contact Page image image

kiliman commented 2 months ago

The error is Link is not defined. Did you remember to import it?

import { Link } from 'react-router-dom'

https://reactrouter.com/en/main/components/link