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

Adding react-router... #6

Closed
Cmdv opened this issue May 25, 2015 · 5 comments
Closed

Adding react-router... #6

Cmdv opened this issue May 25, 2015 · 5 comments

Comments

@Cmdv
Copy link

Cmdv commented May 25, 2015

Hi, I'm experimenting with your repo (here) as I'm trying to extend it by adding more options. If you'd prefer me to fork from here I will.

Anyways on the branch linked above I'm trying to use React-router to do my routing.

Router.run(routes, function (Handler) {
  Model.subject.subscribe((appState) => {
    console.log(appState); //gives correct state
    React.render(
      <Handler {...appState}/>, // appState doesn't seem go through
      document.getElementById('app')
    );
  });
});

do you have a clue how the appState could be passed into the props?!?!

I'm also going to be trying to make a simple Auth and some sort of JSON api, just trying to add some real life implementations 😄

@justinwoo
Copy link
Owner

I remember being annoyed by this, SO thread: http://stackoverflow.com/questions/27864720/react-router-pass-props-to-handler-component

they don't let you pass props into the handler, so you'll have to work around it somehow.

i don't usually use react-router in my own projects though. the most i usually do is hook up to the hash location.

@Cmdv
Copy link
Author

Cmdv commented May 26, 2015

I posted this issue on react-router here and BerkeleyTrue the creator of Thundercats.js came back with some great advice with the use of combineLatest it doesn't fully fix it yet but I'm going to do a little more experimentation as it looks like it's going in the right direction.

@Cmdv Cmdv closed this as completed May 26, 2015
@Cmdv
Copy link
Author

Cmdv commented May 27, 2015

just to let you know I managed to work it out if you look here :)

@justinwoo
Copy link
Owner

huh... so you can pass in props to the root handler?

@Cmdv
Copy link
Author

Cmdv commented May 31, 2015

yeah seems that way and you then have the this.props available on all your routes. I've now added styling and a counter in the navigation to show off the state a little more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants