Stateless functional components

Another concept that is sometimes counterintuitive for beginners is the fact that stateless components do not give us any benefits regarding performance.

They are great for the many reasons that we saw in Chapter 3, Create Truly Reusable Components, and for the way they make our applications simpler and easier to reason about, but they do not have (as yet) any internal implementation that makes them faster.

It is easy to think that they are rendered quicker because they do not have an instance, a state, or event handlers, but at the moment that's not the case.

In the future, they might be optimized (according to the React team), but today they perform even worse because it is not possible to use the shouldComponentUpdate method that, as we have seen before, can help React render the tree faster.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.156.212