-
Notifications
You must be signed in to change notification settings - Fork 83
Upgrade to React 0.12 #97
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
Comments
Another big release - I’ll be handling the update shortly as I update my personal projects, which use RRC.
|
Re: Backcompat, we’ve traditionally told users stuck on older versions of React to use older versions of RRC. Unfortunately, with the major breaking changes we’re seeing often in React, that is often the only way to do it.
|
Noted, thanks for the quick response. |
Just to update - this is pretty involved. The
I'm working on this on the |
Hmm. Reading the example in |
The |
I had a good stab at getting RRC working with 0.12 but ran into a few issues. I get a lot of warnings about components Additionally, client side routing appears to be broken with an error complaining about either Apologies for the vague report. I'll get some more details together for whatever you need if you let me know. |
Is that with the new branch?
|
Yes it is. I installed it through NPM using the Github repo URL ending in |
I think I figured out the issue with the warnings. React depreciated calling components directly to create them. Instead they now want you to wrap them in a factory method, which JSX does for you automatically but you need to do manually when not using it. So the handler components passed into the router need to be wrapped. I created a pull request to this effect, but I'm not sure if calling the factory method as late as possible is correct. I just started using the React framework, so sorry if I'm completely off base with this :). |
I've managed to integrate React 0.12 into my app. It works fine but there are quite a few warnings for me as well. These are my findings: Versions:
Package versions used:
When a route doesn't have a handler:
Trying to use JSX splats:
Is this because I'm not using Node 0.11.x? Probably. This code:
Gives me this warning:
If I remove the The page does render however. Looks like there are a few more things to polish but for me at least RRC with React 0.12 is working fine, just with some warnings. |
I've fixed a few more warnings. There's only one left:
This warning appears just once on startup on the server. Triggering routes and stuff doesn't show this warning. I think it's something in RRC itself. |
@jamwaffles, the For example, try |
Sweet, that did the trick - no more errors! Would it make any sense to have the
I feel like I'm doing something wrong with all those |
Yeah, I think it should automatically create an element. As for the props,
|
I wouldn't mind doing this:
This assumes From an implementation point of view, passing |
Yeah, it should work. It definitely gets complicated in a way - we need to decide from an API standpoint if we require users to call React.createElement() or not. I think we are going to drop support for functions that conditionally return different elements, as well. If you need that functionality, wrap it in an element. Sorry this has gotten kind of shunted on the wayside. I’m neck deep in a product launch and Slush in Helsinki. I will get to this as soon as I can.
|
I'd advocate for having react-router-component call React.createElement on the handlers. Calling createElement for the user would also allow you to pass props down to the routes/pages without modifying the props on a ReactElement which is discouraged and they seem to be removing things that they discourage. It also might be more efficient for you to call createElement on one handler as opposed to the user calling it on all of them. FWIW, rackt/react-router is going to be calling createElement for the user. Good luck on your launch and thank you for this great project! |
FYI the React-0.12 branch was just updated. There's a bit of a weird issue with |
|
More info in their blog post here.
Quite a few breaking changes. Not sure how this is going to work with regards to backwards compatibility.
The text was updated successfully, but these errors were encountered: