close

[Solved] Property ‘exact’ does not exist

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to react-router-dom and I am facing following error Property ‘exact’ does not exist in ReactJS. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How This Error Occurs ?

I am trying to react-router-dom and I am facing following error.

TypeScript error in /Users/veselinkontic/Projects/givellet/frontend/src/components/index.tsx(9,37):
Type ‘{ path: string; exact: true; }’ is not assignable to type ‘IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)’.
Property ‘exact’ does not exist on type ‘IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)’. TS2322

How To Solve Property ‘exact’ does not exist Error ?

  1. How To Solve Property ‘exact’ does not exist Error ?

    To Solve Property ‘exact’ does not exist Error Here If you are using react router v6 then it will not support exact. If You are Using v5 then Use this: <Route exact path=”/” component={Home} /> If You are using v6 Then Use This: <Route path=”/” element={<Home />} /> Now, Your error must be solved.

  2. Property ‘exact’ does not exist

    To Solve Property ‘exact’ does not exist Error Here If you are using react router v6 then it will not support exact. If You are Using v5 then Use this: <Route exact path=”/” component={Home} /> If You are using v6 Then Use This: <Route path=”/” element={<Home />} /> Now, Your error must be solved.

Solution 1: react router v6 doesn’t support exact

Here If you are using react router v6 then it will not support exact.

If You are Using v5 then Use this.

<Route exact path="/" component={Home} />

If You are using v6 Then Use This.

<Route path="/" element={<Home />} />

Now, Your error must be solved.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment