我剛開始使用電子,我一直在積極應對路由器的問題。我不斷收到這樣的警告無論我做什麼:反應路由器+電子位置「/」不符合任何路線
Warning: [react-router] Location "/" did not match any routes
路由器:
"use babel"
import React from 'react'
import { Router, hashHistory } from 'react-router'
/* ******************
IMPORTS
*********************/
import {routes} from './routes'
const App =() => {
return (
<Router history={hashHistory} routes={routes} />
);
}
export default App
路線:
"use babel"
import React from 'react'
import { Route, IndexRoute } from 'react-router';
/* ******************
IMPORTS
*********************/
import App from './src/app.js'
import Root from './src/root'
export default (
<Route path="/" component={Root} />
);
根:
import React, { Component } from 'react'
export default class Root extends Component {
render() {
return (
<div>test</div>
);
}
}
我注意到,反應路由器在斜槓前添加hashtag。我敢肯定,我做了一個新手的錯誤的地方,但我無法找出什麼是錯的......
網址:file:///C:/wamp/www/electron_projects/projectOne/index.html#/
我看過其他類似的問題,但沒有運氣。你的幫助將非常感激。