Looks very strange, when I open the /, the browser will display something like /#/?_k=dlo2cz
in the address. The random query string value changes every time when I refresh the page or switch to other route.
The code were copied and pasted and on react-router branch 1.0.0-rc1
.
import React from 'react';
import { Router, Route, Link, IndexRoute } from 'react-router';
const App = React.createClass({
render() {
return (
<div>
<h1>App</h1>
{/* change the <a>s to <Links>s */}
<ul>
<li><Link to="/about">About</Link></li>
<li><Link to="/inbox">Inbox</Link></li>
</ul>
{/*
next we replace `<Child>` with `this.props.children`
the router will figure out the children for us
*/}
{this.props.children}
</div>
)
}
});
const Message = React.createClass({
render() {
return <h3>Message</h3>
}
});
const About = React.createClass({
render() {
return <h3>About</h3>
}
});
const Inbox = React.createClass({
render() {
return (
<div>
<h2>Inbox</h2>
{/* Render the child route component */}
{this.props.children || "Welcome to your Inbox"}
</div>
)
}
})
// Finally, we render a <Router> with some <Route>s.
// It does all the fancy routing stuff for us.
React.render((
<Router>
<Route path="/" component={App}>
<Route path="about" component={About} />
<Route path="inbox" component={Inbox}>
{/* Add the route, nested where we want the UI to nest */}
<Route path="messages/:id" component={Message} />
</Route>
</Route>
</Router>
), document.body);