LoginSignup
0
0

react-router-domのRouteのexactにエラー 型 '{ exact: true; path: string; element: Element; }' を型 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)' に割り当てることはできません。

Last updated at Posted at 2024-04-06

はじめに

型 '{ exact: true; path: string; element: Element; }' を型 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)' に割り当てることはできません。
  プロパティ 'exact' は型 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)' に存在しません。ts(2322)

のエラー発生

スクリーンショット 2022-04-25 22.42.40.png

結論

react-router-domのv6になり、exactを記述しなくても完全一致となったため、exactは不要になっていた。削除することで対応する。

おわりに

Routeにはexactを記述する印象があったので、少しインパクトがあった。
それくらい当たり前にexactを書くようになっていたため、デフォルトで完全一致になったということだと思う。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0