The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Building a React.js App - ES6 Refactor: Routing without Mixins

Building a React.js App - ES6 Refactor: Routing without Mixins

4:23
In this video, we’ll walk through refactoring the routing of our application to get away from mixins and be compatible with JavaScript Classes through context.
Watch this lesson now
Avatar
egghead.io

In this video, we’ll walk through refactoring the routing of our application to get away from mixins and be compatible with JavaScript Classes through context.

Avatar
Logan

So thankful you covered this. During the react router section I kept worrying I was going to have to give up my nice ES6 so I could use the router mixin.

Avatar
Tyler

Thanks Logan! You'll be happy to hear that React Router 1.0 (coming soon) gets rid of Mixins and you don't even have to use contexts. It's really slick.

In reply to Logan
Avatar
Alex

I am curios about debugger use. I like the idea of looking through the state but is there a way to do tracing instead (besides the obvious logging)?

So, I do not have to stop the world to examine things. It would be very useful for async/timed events. I know it is probably the wrong place to ask but maybe you can give me some references if not the answer.

In reply to Tyler
Avatar
Tyler

Hi Alex. Great question. I'm actually not sure since I always just use debugger. If you find an answer, definitely let me know.

In reply to Alex
Avatar
egghead.io

The lesson video has been updated!

Avatar
Brandon

Hey Tyler, for some reason I'm doing the above and this.history, when passed from my parent component to the child component that needs them its undefined...even though the parent component is defined in routes.js.

When I console.log "this" in my parent component I see the props are defined after I open up the object in the console...and history is there. But right after I print JSON.stringify(this.props.history) and its an empty object. Any reason for this?

In reply to Tyler
Avatar
Brandon

Even adding console.log(this.props.history) in main before my render method console.logs to Object{} but when I actually open the object in the console, I see history there.

In reply to Brandon
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?