Javascript 使用电子路由器的正确方法是什么
那里没有教程,也没有我能找到的走查。所以我试着按照文件上的“教训”来做。让我们来看看我所拥有的,也许你可以看到我哪里出了问题,最好的解决办法是什么 React路由器4.2.0 让我们定义一些路由:Javascript 使用电子路由器的正确方法是什么,javascript,reactjs,react-router-v4,Javascript,Reactjs,React Router V4,那里没有教程,也没有我能找到的走查。所以我试着按照文件上的“教训”来做。让我们来看看我所拥有的,也许你可以看到我哪里出了问题,最好的解决办法是什么 React路由器4.2.0 让我们定义一些路由: import { render } from 'react-dom'; import StartUp from './components/startup.js'; import { Router, Route, hashHistory } from 'react-router'; const Ro
import { render } from 'react-dom';
import StartUp from './components/startup.js';
import { Router, Route, hashHistory } from 'react-router';
const Routes = (
<Router history={hashHistory}>
<Route path="/" component={StartUp} />
</Router>
);
render(
Routes,
document.getElementById('app')
);
这些都是用第3页汇编而成的,以备不时之需。因此,运行此命令时,我在控制台中遇到的错误是:
bundle.js:572 Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`.
in RouterprintWarning @ bundle.js:572
bundle.js:913 Uncaught TypeError: Cannot read property 'location' of undefined
bundle.js:12196 The above error occurred in the <Router> component:
in Router
Consider adding an error boundary to your tree to customize error handling behavior.
bundle.js:16770 Uncaught TypeError: Cannot read property 'location' of undefined
bundle.js:572警告:失败的道具类型:道具'history'在'Router'中标记为必需,但其值为'undefined'。
在RouterprintWarning@bundle.js:572中
bundle.js:913未捕获类型错误:无法读取未定义的属性“location”
bundle.js:12196组件中发生上述错误:
路由器内
考虑将错误边界添加到树中以自定义错误处理行为。
bundle.js:16770未捕获类型错误:无法读取未定义的属性“location”
我假设这是因为我实际上不是在浏览器中,而是在一个“文件”中,如文件所示://…
那么,使用带有Electron的React路由器的最佳方式是什么,这样我就可以利用定义和重定向路由的功能。您可能需要检查一下
bundle.js:572 Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`.
in RouterprintWarning @ bundle.js:572
bundle.js:913 Uncaught TypeError: Cannot read property 'location' of undefined
bundle.js:12196 The above error occurred in the <Router> component:
in Router
Consider adding an error boundary to your tree to customize error handling behavior.
bundle.js:16770 Uncaught TypeError: Cannot read property 'location' of undefined