小编Tur*_*ene的帖子

类型上不存在属性“组件”

为什么当我在“Route”中声明“component”属性时会出现此错误;

类型“IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)”上不存在属性“组件”。

import { Routes, Route } from 'react-router-dom'

import './App.css'
import HomePage from './pages/HomePage'

function App() {
  return(
    <div>
    <Routes>
      <Route path="/" component={HomePage}/>
    </Routes>
    </div>
  )
} ``` The problem might be; because I dont use 'exact path="/"' that might also give an error
Run Code Online (Sandbox Code Playgroud)

react-router

28
推荐指数
3
解决办法
3万
查看次数

标签 统计

react-router ×1