Version 0.6.0 doesn't work with react-router #43

Closed
smashercosmo opened this Issue Aug 9, 2015 · 5 comments

Comments

2 participants
@smashercosmo

I'm having rather strange issue in my app. After upgrading to 0.6.0 transitions to routes stoped working. While url in browser is changing the page stays the same. With 1.0.0-alpha everything works fine.

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Aug 9, 2015

Collaborator

It's a very vague description :-). Can you publish a reproducible example?

Collaborator

gaearon commented Aug 9, 2015

It's a very vague description :-). Can you publish a reproducible example?

@smashercosmo

This comment has been minimized.

Show comment
Hide comment

@gaearon Ok) Here is an example

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Aug 9, 2015

Collaborator

This is facebook/react#2517 showing its head again.
The easy fix is to always pass props down when the router state changes.

Instead of:

Router.run(routes, Router.HistoryLocation, (Handler) => {
  React.render(
    <Provider store={store}>
      {() => <Handler />}
    </Provider>, document.getElementById('root'));
});

write

Router.run(routes, Router.HistoryLocation, (Handler, props) => { // note "props" here
  React.render(
    <Provider store={store}>
      {() => <Handler {...props} />} // note "props" here
    </Provider>, document.getElementById('root'));
});

We need to document this.

I think this shouldn't affect React Router 1.0 but if you could verify this, it would be nice.

Collaborator

gaearon commented Aug 9, 2015

This is facebook/react#2517 showing its head again.
The easy fix is to always pass props down when the router state changes.

Instead of:

Router.run(routes, Router.HistoryLocation, (Handler) => {
  React.render(
    <Provider store={store}>
      {() => <Handler />}
    </Provider>, document.getElementById('root'));
});

write

Router.run(routes, Router.HistoryLocation, (Handler, props) => { // note "props" here
  React.render(
    <Provider store={store}>
      {() => <Handler {...props} />} // note "props" here
    </Provider>, document.getElementById('root'));
});

We need to document this.

I think this shouldn't affect React Router 1.0 but if you could verify this, it would be nice.

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Aug 9, 2015

Collaborator

Documented in d4ae7b4.

Collaborator

gaearon commented Aug 9, 2015

Documented in d4ae7b4.

@gaearon gaearon closed this Aug 9, 2015

@smashercosmo

This comment has been minimized.

Show comment
Hide comment
@smashercosmo

smashercosmo Aug 9, 2015

thx for the clarification)

thx for the clarification)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment