未捕获的ReferenceError:IndexRoute未定义-如何解决此错误以在react路由器中使用IndexRo
Uncaught ReferenceError: IndexRoute is not defined - How do I resolve this error to use IndexRoute in react-router?
我有一组使用react路由器的简单路由:
ReactDOM.render(
<Router history={appHistory}>
<Route path="/" component={MainLayout}>
<IndexRoute component={Index} />
</Route>
</Router>,
document.getElementById('app')
);
然而,页面加载失败,我在浏览器控制台中收到以下错误:
Uncaught ReferenceError: IndexRoute is not defined
我该如何解决这个问题?
import { Router, Route, IndexRoute } from 'react-router';
import {IndexRoute} from 'react-router'
不适用于react-route-4。react-router-4发生了变化,不再有子代。但是,使用"路由"组件,可以渲染与路径匹配的任何内容。
相关文章:
- React Redux错误页面管理
- Mocha react本地路由器编译错误
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- React JS:未捕获(在承诺中)语法错误:在位置 0 的 JSON 中意外<令牌
- React路由器错误-'无法调用方法'getRouteAtDepth'的未定义'
- React+Redux-未捕获错误:操作可能没有未定义的“;类型“;所有物
- React和Browserify寄存器组件错误
- react.js foreach变量错误
- React.js错误;相邻的JSX元素必须被封装在一个封闭标记“中;
- 未捕获的类型错误:hook.apply不是在react路由器中使用onEnter时的函数
- 接收'错误:找不到模块'使用browserfy、gullow、react.js
- 更新时React Redux调度导致递归错误
- jquery.mobile-1.4.5.js:26未捕获类型错误:无法设置属性'移动'react应用程序
- React,Flux,React路由器调度错误-可能的批更新解决方案
- 为什么React在类构造函数中使用setState方法时抛出错误
- 如何修复require.确保错误Webpack,Babel6,React
- 未捕获的ReferenceError:IndexRoute未定义-如何解决此错误以在react路由器中使用IndexRo
- react客户端呈现错误无法获取/
- react chartjs错误无法读取属性'图表'的未定义
- React应用程序错误'未捕获的ReferenceError:React未定义'