> So all you have to do is use PureComponent everywhere and you’re good to go. There’s nothing more to it. Enjoy your new blazing fast React app! (I work on React.) This isn't quite right. If we recommended that PureComponent be used everywhere, it would probably be the default already. Rather -- the comparison to decide whether or not a component should be rerendered costs something, and in the case that you do want…
Optimizing React Rendering
71–79 of 79 posts
Re: Optimizing React Rendering
#72Earlier quoted context omitted.
nit: new component instance (not element)
I think we're both right- I believe it will create a new element and a new DOM element, rather than mutating the existing ones.
Re: Optimizing React Rendering
#73> So all you have to do is use PureComponent everywhere and you’re good to go. There’s nothing more to it. Enjoy your new blazing fast React app! (I work on React.) This isn't quite right. If we recommended that PureComponent be used everywhere, it would probably be the default already. Rather -- the comparison to decide whether or not a component should be rerendered costs something, and in the case that you do want…
how expensive are shallow === checks compared to re-rendering unnecessarily though? what advantages would stateless functional components offer above purecomponents?
Re: Optimizing React Rendering
#74Re: Optimizing React Rendering
#75From what I've found in my current job creating a js react app as well as side project with cljs is that advanced optimsation of js react === basic usage of clojurescript reagent. I've found no redeeming features when developing the is app, issues with hot reloading and constant integration work to get everything to play nice with immutable js
Re: Optimizing React Rendering
#76> So all you have to do is use PureComponent everywhere and you’re good to go. There’s nothing more to it. Enjoy your new blazing fast React app! (I work on React.) This isn't quite right. If we recommended that PureComponent be used everywhere, it would probably be the default already. Rather -- the comparison to decide whether or not a component should be rerendered costs something, and in the case that you do want…
how expensive are shallow === checks compared to re-rendering unnecessarily though? what advantages would stateless functional components offer above purecomponents?
Re: Optimizing React Rendering
#77Earlier quoted context omitted.
so basically the Facebook app team? Edit: sorry guys, didn't knew you were all on HN :(
Anyone else sick of the incredibly lazy "shill"-type accusations being thrown around lately? Just because a post is heavily upvoted or downvoted does not mean the team behind the post is brigading or manipulating it. Let's loosen those tinfoil hats just a bit.
But now that we are at it, why don't you give me another probable reason a harmless comment was downvoted?
Re: Optimizing React Rendering
#78Earlier quoted context omitted.
The downvotes are sad. Are people this far gone that they can't take a little criticism?
Offtopic, but regarding the downvotes - I have been using FB front-end projects for several years, and today I see them as _the_ gold standard for a supportive, mature, well-governed, and consistent FoSS ecosystem. I struggle to recall any snarkiness, cynicism, or even rudeness. I'm sure it happens, but I closely monitor several of their projects and the behavior is mostly exemplary even without considering the size…
https://news.ycombinator.com/item?id=11057857
Re: Optimizing React Rendering
#79One thing that has been bothering me is that React is slow by default. It re-renders everything every time unless you start looking into shouldComponentUpdate. Even if I agree that premature optimization is the root of all evils, I like when the language and the framework I use make it writing fast code as easy as writing slow code. I wonder if anybody has evaluated, the improvement they get in development speed usin…
If the total re-render is occurring under 16.67ms (60fps) in a non-trivial use-case I'm usually fine leaving it as-is. Most render cycles taking longer than that involve operations on large data sets or events firing at the millisecond level (mouseover, drag, etc) - and those are worth fixing as they'll actually have noticeable impacts on the user experience. But I tend not to optimize just to pat myself on the back for "optimization".