lafactory.blogg.se

React code
React code









react code react code

And then refactor each step with performance in mind, and extract a generalized rule from every step that can be applied to most apps most of the time. I’m going to do that by implementing a “real-life” app step by step, first in a “normal” way, using the patterns that you’ll see practically everywhere and surely used multiple times by yourself. So this is exactly what I want to prove in this article 😊. You just need to know a few patterns to watch out for in order to do that meaningfully. Basically, “premature optimisation”, when it comes to React and performance, can actually be a good thing and something that everyone should do 😉. The good news is, it’s also incredibly easy to prevent those mistakes and write code that is performant most of the time right away, thus significantly reducing the time and effort it takes to investigate performance problems since there will be much fewer of those. What I don’t like about React, is that it also makes it incredibly easy to make mistakes with huge consequences that are not visible right away. What I like about React, is that it makes implementing complicated UI interactions incredibly easy. Which loosely translates into “don’t fix that is not broken” and is quite hard to argue with. Usually, performance experts are the proponents of “premature optimisation is the root of all evil” and “measure first” rules. Is it even possible to say anything definitive here or to make any generalized recommendations? Performance and React! Such a fun topic with so many controversial opinions and so many best practices flipping to be the opposite in just 6 months.











React code