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

Add <Link replace> and <Redirect push> #3912

Merged
merged 3 commits into from Oct 6, 2016
Merged

Add <Link replace> and <Redirect push> #3912

merged 3 commits into from Oct 6, 2016

Conversation

aaugustin
Copy link
Contributor

These props allow selecting pushState and replaceState for navigating to
the next state.

Fix #3903.

Copy link
Member

@timdorr timdorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for including the docs updates! 👍

@timdorr timdorr added this to the v4.0.0 milestone Sep 19, 2016
@mjackson mjackson changed the title Add <Link replace/> and <Redirect push/>. Add <Link replace> and <Redirect push> Sep 28, 2016
These props allow selecting pushState and replaceState for navigating to
the next state.

Fix #3903.
Document how to manage history in combination with Redirect.
@timdorr
Copy link
Member

timdorr commented Oct 3, 2016

@mjackson or @ryanflorence any thoughts on this? I think it's fine for what it is.

@ericf
Copy link

ericf commented Oct 3, 2016

I ended up implementing a custom <Navigate> component in my app to deal with this. It definitely feels like a missing gap for a common use case.

import {Component, PropTypes} from 'react';
import {router as routerShape} from 'react-router/PropTypes';

export default class Navigate extends Component {
  static contextTypes = {
    router: routerShape.isRequired,
  };

  static propTypes = {
    to: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.object
    ]).isRequired,
  };

  componentDidMount() {
    this.context.router.transitionTo(this.props.to);
  }

  render() {
    return null;
  }
}

I read it a few times and couldn't figure out what it was saying... 😕
@ryanflorence ryanflorence merged commit eac8217 into remix-run:v4 Oct 6, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants