-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you change routes... #16
Comments
If you are using the react-starter-kit, then there is a Location module. Use
|
@koistya is this the right way? |
Check the new import React from 'react';
import Location from '../core/Location';
function navigateToPath(event) {
event.preventDefault();
Location.push('/to/path');
}
function navigateToPathWithState(event) {
event.preventDefault();
Location.push({ pathname: '/to/path', state: { foo: 123 } });
}
// Stateless functional React component
function MyComponent() {
return (
<div>
<button onClick={navigateToPath}>Click me (1)</button>
<button onClick={navigateToPathWithState}>Click me (2)</button>
</div>
);
}
export default MyComponent; And inside the client-side bootstrap code ( Summary
|
what happened to Location and what is the replacement? EDIT: now it's easy to use history from history.js in kit or just reference createBrowserHistory();
|
without reloading the page? there are tricks like transitionTo and history in react-router; do these work with react-routing as well?
Dave
The text was updated successfully, but these errors were encountered: