问题
I am trying to build a parallax website with react and react-router
In most react-router examples I found, target dom node is replaced with Handler corresponding to the route.
var routes = (
<Route handler={App} path="/">
<DefaultRoute handler={Home} />
<Route name="about" handler={About} />
<Route name="users" handler={Users} />
</Route>
);
Router.run(routes, function (Handler) {
React.render(<Handler/>, document.body);
});
How can I render all the route handlers into single page and jump to specific location in a page with react-router ?
回答1:
I think what you want to use is the <Link to="#LOCATION" />
. It says in the documentation about the to attribute of the Link tag: The name of the route to link to, or a full URL.. Try that and see if that works.
来源:https://stackoverflow.com/questions/28590040/how-to-use-react-router-to-jump-to-specific-location-in-the-page