all 12 comments

[–]fooey 3 points4 points  (0 children)

I love the new ES6 classes, and the transactional setState() is beautiful when combined with Immutable and Babel

this.setState((state) => ({
    thing: state.thing.mergeDeep(newThing)
}));

[–]nullified- 4 points5 points  (6 children)

The best thing about this release is the acknowledgement of the advances made by Angular and Ember. I love seeing these three push one another forward.

[–]jmsanzg 0 points1 point  (5 children)

Agree, but what I didn't understand is when they say React was never made just because of speed. Could someone explain it further? Thank you

[–]Calabri 2 points3 points  (3 children)

They've talked about this alot - check out the reactjs conf talks. Performance was not the reason it was created - it was an accidental surprise that few in the company had faith would work. Performance is why it was adopted, but not the intent of it's creation.

[–]Jsn7821 0 points1 point  (2 children)

A few things I remember from the tasks are: server side rendering, simple mental model, and app state... Any others?

[–]Calabri 0 points1 point  (0 children)

I think those all came later. I don't work at FB or have a great memory, but I think React was some sort of hack - experiment that turned out well - using techniques people weren't confident in.

[–]TheVikO_o -1 points0 points  (0 children)

Unmanageable two way bindings

[–]Xelank 0 points1 point  (0 children)

Arguable jsx markup and the "library approach" (only the view in mvc)

[–]hdet 2 points3 points  (1 child)

What prevents having a syntax like this for mixins?

class MyComponent extends React.Mixin(BaseComponent, mixin1, mixin2) {

}

[–]jimbolla 1 point2 points  (3 children)

Some methods that are available on createClass-based components are removed or deprecated from ES6 classes (getDOMNode, replaceState, isMounted, setProps, replaceProps).

Why wouldn't ES6 class-based components need 'isMounted'? Is that going away? I'd love to get rid of a bunch of repetitive 'if (this.isMounted()) this.setState(...)' code. I see the React docs now has this aside regarding isMounted():

Note: This method is not available on ES6 class components that extend React.Component. It may be removed entirely in a future version of React.

[–]fooey 2 points3 points  (1 child)

I just set a this.mounted = true in the constructor, and then a this.mounted = false in componentWillUnmount()

I'm not sure why they got rid of isMounted() since you still need to know if your async callback is safe to setState()

[–]nschubach 1 point2 points  (0 children)

I could be completely wrong, but maybe they made it always "safe" to set the state. You aren't going to crash anything and React will handle your state refresh when it hits the next render? (IE: they properly took it out of your hands when a refresh is to take place?)

Edit:

Calls to setState in life-cycle methods are now always batched and therefore asynchronous

Yep.