Why hasn't React released a new version for a year?

Hello everyone, I am Carson.

Thinking back to the past few years, no matter whether it is Reactor not Vue, they are rapidly iterating versions, so that many students complain that they can't learn anymore .

And now, Reactit has not been updated and stable for a year release.

The last release was in June 22

Some people even think that this is the most direct evidence that the front end is dead :

So, Reactwhy hasn't it been published in the past year? Is it because there is no new work to do in the field of front-end frameworks? React v19Is it too far away?

Welcome to watch the circle of friends, join the high-quality front-end communication group of human beings , and take the lead

Has React been active in the past year?

For students who don’t want to read long articles, here is a sentence to summarize the point of view of this article:

ReactThe reason why the version has not been released for a year is not because there is no work to do, but to complete UIthe transformation of the framework from library to meta-framework

First of all, let's take a look, Reacthas the update activity decreased in the past year?

From pushthe perspective of the amount of code, the last year is even releasemore active than the previous years with more output:

Now that you are more active, Reactwhat exactly are you doing during this time? You can get a glimpse of the clues from the number of lines added or deleted in the code , where:

  • The green column represents the increase in the number of lines of code

  • The red column represents the reduction of the number of lines of code

  • The red broken line represents the overall trend of the number of lines of code

From the perspective of code volume changes , Reacthistory can be roughly divided into four periods:

  • 13 years of open source, to the functional iteration period before 17 years

  • Refactoring period lasting until 18 years (refactoring React Fiberarchitecture)

  • 18~22年基于Fiber架构的新功能迭代期

  • 22年至今的重构期

功能迭代期重构期的区别在于:

  • 前者主要是在稳定的架构上迭代新特性

  • 后者一般重构底层架构的同时,重构老特性

剧烈的代码量波动通常发生在重构期。比如,在最近的重构期内,PR #25774删除了3w行代码。

这个PR主要改变React对于同一个子包,同时拥有.new.old两个文件的开发模式

最近一年React都在干啥?

明确了React最近一年处于重构期。那么,究竟是重构什么呢?

答案是 —— 将RSCReact Server Component,服务端组件)接入当前React体系内。

有同学会问:RSC只是个类似SSR的特性,为什么要实现他还涉及重构?

这是因为RSC不仅是一个特性,更是React未来主要的发展方向,其意义不亚于Hooks。所以,围绕RSC的迭代涉及大量代码的重构。比如:

  • SSR相关代码需要修改

  • SSR代码修改导致Suspense组件代码修改

  • Suspense的修改又牵扯到useEffect回调触发时机的变化

可以说是牵一发而动全身了。

RSC为什么重要

为什么RSCReact这么重要?要回答这个问题,得从开源项目的发展聊起。

开源项目要想获得成功,一定需要满足目标用户(开发者)的需求。

早期,React作为前端框架,满足了UI开发的需求。在此期间,React团队的迭代方向主要是:

  • 摸索更清晰的开发范式(发布了Error BoundraySuspenseHooks

  • 修补代码(发布新的Context实现)

  • 优化开发体验(发布CRA

  • 底层优化(重构Fiber架构)

可以发现,这些迭代内容中大部分(除了底层优化)都是直接面向普通开发者的,所以React文档(文档也是面向开发者的)中都有体现,开发者通过文档能直观的感受到React不断迭代。

随着前端领域的发展,逐渐涌现出各种业务开发的最佳实践,比如:

  • 状态管理的最佳实践

  • 路由的最佳实践

  • SSR的最佳实践

一些框架开始整合这些最佳实践(比如Next.jsRemix,或者国内的Umijs...)

到了这一时期,开发者更多是通过使用这些框架间接使用React

感受到这一变化后,React团队的发展方向逐渐变化 —— 从面向开发者的前端框架变为面向上层框架的元框架。

发展方向变化最明显的表现是 —— 文档中新出的特性普通开发者很少会用到,比如:

  • useTransition

  • useId

  • useMutableSource

这些特性都是作为元框架,给上层框架(或库)使用的。

上述特性虽然普通开发者很少用到,但至少文档中提及了。但随着React不断向元框架方向发展,即使出了新特性,文档中已经不再提及了。比如:

  • useOptimistic

  • useFormStatus

Most of the above two Hookpresumably have not heard of it. They are Reactactually present in the source code Hook. However, because it is a product of the meta-framework concept, Reactthe document does not mention it. Instead, see the usage introduction in the Next.js documentation .

Summarize

ReactThe reason why there has been no stable release for a year releaseis because the development direction has changed from being developer- oriented to upper-level frameworks .

The updates during this period are all oriented to the upper-level framework, so it is difficult for developers to perceive Reactthe changes.

But this does not mean that Reactthe iteration has stopped, nor can it be considered that the front-end development has stagnated.

If we must quantitatively observe Reactthe development of the past year, the distance from React v19the milestone is roughly halfway:

Guess you like

Origin juejin.im/post/7254171813117820985