Member-only story
React is about to release Compiler, it’s time to say goodbye to useMemo/useCallback!
Recently, the React team published an article on their official blog, introducing some of the team’s work from the last major version release to February 2024.
What surprised me the most was the React Compiler
.
As we all know, when introducing React
, people always say that it is a re-runtime framework, because it itself does not do a lot of optimization actions for rendering when compiling.
This gives developers a lot of flexibility during the development phase. React
provides us with APIs such as useMemo/useCallback
, which puts the means of runtime optimization in the hands of developers. But this also brings great mental burden to developers.
Although using React
well can make your application have extreme performance, in fact, using React
well is far more difficult than we think.
In contrast, Vue.js
such frameworks are different, everyone says that Vue
is easier to get started with than React
, more suitable for beginners, mainly because it does not have so many twists and turns, many optimization matters can be done when compiling.
This time React
launched Compiler
may break everyone's conventional cognition.
The official React blog describes it as follows:
When the state changes,
React
can sometimes over-render. Since the advent ofReact
, our solution to such situations has been manual caching…