-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Boatload of methods removed from State mixin #1502
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
Not sure either. One reason for their removal could be that your route handlers get everything else injected as props anyway
|
Well, I'm not sure that's as useful. For instance - I have a Would have been way cleaner just having the State mixin. |
Well, if a component depends on something, passing it via props and being explicit about it is the cleanest way imo. I'm not objected to bringing back the old mixin methods though. |
+1 for bringing back the old mixin methods. A workaround would be pretty easy; all one has to do is make the topmost route component put the pathnames, params, query, etc. obtained from |
Not sure if this is the reason for it, but mixins don't exist in ES6 style classes, just to keep in mind. |
We're generally trying to move away from mixins, so you'll have to use the props we pass to your route handler components instead. This will help users making the transition to ES6 classes (and possibly other usage paradigms, like pure functions) still be able to use the router. |
You mean you guys don't hope class mixins are incorporated into a future version of JS? I'm a little disappointed you'd give them up that easily. I did more than enough Java programming and debugging complex inheritance hierarchies, and I thought it was cool, until I got to JS and could use mixins. Besides, there are any number of alternative methods React could provide to mix methods into an ES6 class prototype. |
I've felt like React has served the community very well so far. If React takes away the convenience of things like the ReactMeteorData mixin I've been using, they'd better come up with a better alternative. |
I‘d rather see react-router take the approach that sebmarkhage (very active in the React project) advocates for them: "However, I think we need to wait on this and not thrash this API since there is active work exploring what first-class mixins would look like in ES7+." |
He said many things :-). Some things he said later:
I wouldn't say mixins are the future for React, especially considering work in progress on components as pure functions. You can use the mixins if you like them, but libraries like React Router should provide a solution that works for everyone, and injecting props is the React component API. |
To be clear, we are going to ship a 1.0 API that will use mixins, namely the Having said that, all I'm saying here is that I don't want to introduce any more mixins because we'll be moving away from them post 1.0. |
Summary: https://docs.google.com/document/d/1i2bhSamrNs1C2RVP8T0bYcJ8SavNRAlNn6isU2_WI9w/edit Also: https://docs.google.com/document/d/1QvQcinFbo2IJ104fVNRc88QYcLdVMXnvQ3ONPTDVDEE/edit When updating the TOC, I noticed a bug in the script, which I fixed. Test Plan: Visited file:///home/csilvers/khan/style-guides/style/javascript.md in a browser with a markdown-rendering plugin, and saw that the new section rendered ok. Reviewers: jared, emily, jlfwong, riley, kevinb Reviewed By: kevinb Differential Revision: https://phabricator.khanacademy.org/D22321
Is this still the plan? if so, any idea when/where? |
What specifically did you want from that mixin? |
From State |
Of course. Those are respectively |
Maybe I'm missing something. Are you saying that As far as I can tell, the |
I see. Thanks for the clarification. The comment FWIW, i wrapped it up in a mixin that I can drop in. Seems to work well.
|
So, in the latest commit to the State mixin, I can see that a boatload of functionality was stripped and moved here:
https://github.com/rackt/react-router/blob/master/modules/URLUtils.js
However, what I don't see is now a way of easily doing any of it in my components. Is there a way to reach this functionality? Or has it been removed with a vague assumption that nobody wants anything but
isActive()
from their State mixin?The text was updated successfully, but these errors were encountered: