-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Umbrella 0.14 #3220
Comments
Hmm, this seems kind of weird to me, especially in-light of |
Breaking this out into a separate discussion in #3223. Not sure what you mean by "passing a ReactEvent"...? Anyway we |
Deprecate replaceState? What about things like: https://github.com/facebook/immutable-js/wiki/Immutable-as-React-state |
@kharin As that page mentions, it is safer to use a nested state property anyway. We could build native support so that this would work: getInitialState() {
return Immutable.Record({count:0})();
},
handleClick() {
this.setState(this.state.update('count', v => v + 1));
}, We would merge it in React. We would likely only support the Record type, and not Maps though. It would still have problems with mixins. |
@sebmarkbage the Record trick looks great! I'm not sure what would be performance implications, though. If React were to merge it as usual it's likely to be slower since V8 de-ops property setters. Just wanted to know you thoughts on the practice. So, if I understood correctly, using replaceState() (in this use-case) is discouraged until React lends some sort of native support? |
That's right. I added a spin-off Issue for discussion. #3236 |
I wouldn't be surprised if i'm just coming to this conversation without the proper context, etc (still somewhat new to react :) but perhaps this will be helpful to others in my position. I have two basic questions:
thanks for a great lib :) |
|
@spicyj great - thanks! |
Naming nitpicking: "Stateless function" is redundant. It's like saying "Wingless dog". "Functions as stateless components" is more correct. |
Well, React supports winged birds, wingless birds, and (soon) wingless dogs. I'll change the name in the checklist above though. |
Every science and community has contextual terminology where you drop redundant terms. All these terms are also contextual to our field. I'm sure they mean something completely different in the world of plumbing and they would prefer it if we add more context. In the world of the React community, the word "component" is often redundant. For example, when we say "instance" we often drop the "component" part. In the broader sense, a "stateless function" is NOT redundant since it clarify the difference from a "closure" with captured state. You could build one of these single function components by using the closure to capture state for callbacks. In fact, that has been suggested. |
The presence or absence of a function closure is orthogonal to statefulness. A function can have references to constants in a closure and still be a pure function. Or a function might have no closure attached, and still be side-effectful, by taking as parameter a reference to some mutable data structure and mutating it. That's the Deku approach actually. React isn't really that separated from the rest of the programming community, and "Science" for that matter. You're using well known concepts such as nodes on a UI tree, and pure functions. Why not name it correctly instead of risking confusing programmers by introducing creative names for pretty common programming concepts. |
That's why I clarified that it captured state. I don't need a condescending terminology lesson, thanks. This is an internal React issue tracker, used for our communication and tracking of issues, and not a blog post broadcasting new creative concepts. It is expected that the reader is aware and understands the distinction. |
I should clarify why this matters. Doing development in the open is a curtesy. Lots of teams do this kind of progression in private. We even do that way too much by virtue of face-to-face meetings. I would like us to be more transparent. To make that happen, we don't want to be in a situation where we have to tailor our communication in a clear and timely fashion. That's what blog posts are for. I definitely don't want anyone to have to hesitate to post because they feel they'll need to have a clear chain of arguments, make it understandable to a broader audience without context or because of fear from the terminology police. This space should be as accessible to our core team as possible. Even if that means contextual terminology, missing information if you're not part of wider conversations or even exploratory concepts that may or may not end up at already commonly known concepts. That's why I'm pushing back. Feel free to ask clarifying questions though. |
It was just a side note. |
@jimfb Can I pass " |
Yes, I'll update the umbrella issue. |
it's already deprecated, isn't it? or should this be in |
@chicoxyzzy 0.13 didn't have a runtime warning for it. |
@spicyj maybe release a point release now and add some deprecations. So that when 0.14 comes around you can kill more code. There seems to be some work and time left for 0.14 release. |
@nmn We generally don't add any new functionality/deprecations to point releases (only minor bug fixes). Also, we're working hard to get 0.14 out the door, and increasing the scope of the release won't make it happen any faster :). |
Does the fact that you released the beta without #3995 mean that you are dropping it from 0.14? |
@nbostrom No promises, but I think we're still going to try to squeeze that in for 0.14. We were just a little too busy before ReactConf Europe, and it wasn't quite ready in time for beta1. |
Thanks for the quick answer. I do hope you find the time, but at the end of the day I guess that it's really just a nice-to-have. |
#3995 hit a block because some unfortunate timing in the initialization code forcing an unfortunate branch. I think we can probably fix that and get a better implementation by restructuring some other code. Priorities in terms of releases sometimes get prioritized based on what gets blocked on it. I.e. if we don't add/deprecate certain things in release A then we can't do something else in release B. So this kind of sequencing is important. New APIs like this one often doesn't block anything else so they're easy to bump. They can always go into an ad-hoc release later on though. So we should be able to get it in soon. |
I'm currently experimenting with migrating to 0.14 beta, and having a lot of trouble with the deprecation of I'd like to request that the official 0.14 release include some extra docs/examples of how to migrate away from EDIT Feel free to message me on Slack @ reactiflux for additional info. My username is |
Just re-call React.render (or |
@spicyj No, that doesn't solve the setProps problem. He wants the blog post on the ReactComponentRenderer, which includes a setProps and replaceProps helper. @sebmarkbage Let's figure out the blog post today. I have a couple drafts in the Google doc. Just let me know what you want here and we can put it up. |
@JSFB Not what I read from
but let's get the blog post out too. :) |
To clarify Functions as Components. Is this just an optimization thing? No JSX style? For example, would I have to use these components like...
|
@rchanou It allows for performance optimizations in the core (since we don't need to keep/track instances) and it also means less boilerplate/typing for you (since you just need a function, instead of a fullblown class). You would still be able to use the component using JSX, just like any other component, it would still be |
@jimfb Yeah, I want to use JSX :) I just realized I will probably need to use the Babel 5 React options in my webpack babel-loader options, right? Both |
May I suggest that the notes include more detail about lifecycle methods (especially how |
Stateless component functions are as if you had no shouldComponentUpdate, or a shouldComponentUpdate that always returns true. |
@spicyj Thanks for the clarification! So then, if you have a "smart" component that will render depending on |
New Cool Features
Package changes
SeparatePackages for react isomorphic, dom and server rendering [Still need to handle https://github.com/How to use Perf and TestUtils #4279 ] (@zpao)Remove from react repo. (Possibly kill already deprecated ones like classSet)Build with warnings if existing package is used? (@zpao)@providesModule
React (@amasad, @sebmarkbage)currentOwner
which React DOM still needs to set on React Isomorphic. (@sebmarkbage) See comment in Reorganize Src Directory for Isomorphic React Package #3866Kill Deprecations from 0.13
Object.freeze
props increateElement
in DEV, remove old props mutation warnings. (@jimfb) see Freeze ReactElement.props in dev mode #4172.React.addons.createFragment
return a toArray from objects (@spicyj)_isReactElement
(@spicyj)ComponentClass.type
(@jimfb) see Kill .type (was deprecated in 0.13, to be removed in 0.14) #4009New Deprecations
Probably not
event.path
if available. E.g. in shadow DOM. (@jimfb) see Make events propagate through shadow DOMs. #4150. (Disabled in Disable event.path handling #4585)The text was updated successfully, but these errors were encountered: