News for hackers. Stuff that matters.
Re:Optimizing React Rendering by rhinoceraptor on Thursday May 25, 2017 @02:26PM (#14419096)
How do function(al?) components compare in performance to PureComponents?

e.g.,

    const MyComponent = props => (...);
vs

    class MyComponent extends PureComponent {...}
Re:Optimizing React Rendering by korm on Thursday May 25, 2017 @03:20PM (#14419427)
A functional component is not pure, it's exactly the same as its class counterpart. You can use recompose's[0] 'pure' HOC to turn it into a PureComponent.

[0] https://github.com/acdlite/recompose

Re:Optimizing React Rendering by doytch on Thursday May 25, 2017 @04:18PM (#14419826)
I believe their question is asking about the trade-offs of a PureComponent, which is a Class and incurs a performance hit because of that versus a functional component which is always faster than the equivalent component written in a Class-y syntax.

I.e., do the gains from PureComponent exceed the cost of a Class? Personally I would assume they would otherwise no one would ever think of think using one, but it is an interesting question and set of metrics that could be gathered.

Re:Optimizing React Rendering by korm on Thursday May 25, 2017 @05:23PM (#14420247)
Not sure I understand your question. Functional components and class components both use createClass internally IIRC. In any case, they are the same. A PureComponent is simply a Component with shouldComponentUpdate written for you. Functional components can't be pure, but you can use an enhancer for them.