I am trying to create a simple application that really does nothing. It’s not easy for me to work with a jet router.
The version of the responsive router that I am using is 1.0
I get an error
Warning: Location "/" does not match routes
Below is my code
Main.js
import React from "react";
import ReactDOM from "react-dom";
import { IndexRoute, Router, Route, Link } from 'react-router'
import createHistory from 'history/lib/createBrowserHistory';
import Template from './modules/template'
import Index from './modules/index'
import NotFound from './modules/notfound'
let history = new createHistory();
var routes = (
<Router history={history}>
<Route path="/" component={Template}>
<IndexRoute component={Index}/>
<Route path="*" component={NotFound}/>
</Route>
</Router>
);
ReactDOM.render(routes, document.getElementById('glass-app'));
index.js
import React from "react";
import RouteHandler from 'react-router';
export default class Index extends React.Component{
render(){
return <div>Hello World!</div>
}
}
Template.js
import React from "react";
import RouteHandler from 'react-router';
export default class Template extends React.Component{
render(){
return <div>
<div>My Header</div>
<RouteHandler/>
</div>
}
}
Notfound.js
import React from "react";
import RouteHandler from 'react-router';
export default class NotFound extends React.Component{
render(){
return <div>
The Page You Were Looking For Can't Be Found
</div>
}
}
Webpack Configuration
var webpack = require('webpack');
module.exports = {
entry : {
javascript : "./public/js/main.js",
html : "./public/index.html"
},
output : {
path : __dirname + '/dist',
filename : 'bundle.js'
},
devtool: 'inline-source-map',
devServer:{
historyApiFallback: true
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module : {
loaders : [
{test: /\.jsx?$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/},
{test : /\.html$/, exclude: /node_modules/, loader : 'file?name=[name].[ext]'}
]
}
};
I read a lot of posts with similar suggestions, but no luck. Any help would be greatly appreciated.