Skip to content
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

Feature Request: Add a static for transitioning to new page #1

Closed
motleydev opened this issue Jun 10, 2016 · 3 comments
Closed

Feature Request: Add a static for transitioning to new page #1

motleydev opened this issue Jun 10, 2016 · 3 comments

Comments

@motleydev
Copy link

Instead of requiring an onClick event to navigate pages, it'd be nice to have a static available such as Link.to(path) to call after a complex process.

@koistya
Copy link
Member

koistya commented Jun 10, 2016

Something like this?

import { history } from 'react-app';
history.push(path);

or..

class UIComponent extends React.Component {
  render() {
    this.context.history.push(path);  
  }
}

@motleydev
Copy link
Author

history.push would be awesome! That's exactly what I'm thinking. The other possibility would be to have a callback to Link that you could define a function that get's called before the history stuff takes place. I'm essentially trying to set a global lang param on my redux store that then dictates how the page get's reloaded.

@koistya
Copy link
Member

koistya commented Jul 25, 2016

I have temporarily removed the runtime components, will bring them back in the next version.

In the current template you can do:

import history from './core/history';

class UIComponent extends React.Component {
  render() {
    return <div onClick={() => history.push()}> ... </div>;
  }
}

@koistya koistya closed this as completed Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants