We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
因为我看到处的文章都是在说concurrent模式的时间切片,但是明明就没开启,搞的我很懵逼
The text was updated successfully, but these errors were encountered:
主要就是想了解下,是不是其实除了没有开启concurrent模式外,其他的什么优先级那些都是存在的
Sorry, something went wrong.
18以前都是同步的,没有开启时间切片,也没有开启可中断渲染。现在18是开启了的。
其他的update优先级,渲染优先级是存在的。但是由于legacy模式下没有concurrent特性,故大部分的优先级是没有场景用的(虽然源码里面有,但是大部分没用上)。
18开始,优先级的使用场景要丰富很多,大部分都应用上了
的确是的。传统模式(包括18),都是同步循环。只有开启了并发特性的,比如使用了 createRoot 或者 useTransition 等,才会进入并发。进入时间分片的要求更加严格,需要不包含阻塞的优先级以及没有超时的更新,才会开启时间分片
createRoot
useTransition
https://github.com/facebook/react/blob/f7b44539ca9c2d126c7d12cfd0d9d4f13ad5851f/packages/react-reconciler/src/ReactFiberWorkLoop.new.js#L875
const shouldTimeSlice = !includesBlockingLane(root, lanes) && !includesExpiredLane(root, lanes) && (disableSchedulerTimeoutInWorkLoop || !didTimeout);
No branches or pull requests
因为我看到处的文章都是在说concurrent模式的时间切片,但是明明就没开启,搞的我很懵逼
The text was updated successfully, but these errors were encountered: