《React 设计原理》勘误与资料与交流
-
交流请加卡颂微信(kasong555),(备注:书),拉你进群
《React设计原理》勘误、资料、交流
《React 设计原理》勘误与资料与交流
交流请加卡颂微信(kasong555),(备注:书),拉你进群
const propValue = newProps[propName];
propValue
已经在[102][12]处声明,[102][22]处else
块中的声明应可删除。
var _jsxRuntime = require("react/jsx-runtime);
var element = jsxRuntime.jsx("h1", {children:"Hello,world!"});
错误:return '${name1()} 和 ${name2()}';
正确:return `${name1()} 和 ${name2()}`;
上文6.2中列举触发状态更新的方法中讲到了 useReducer dispatcher
下文也有说到“在render阶段执行updateReducer方法”
所以这里应该要说的是 useReducer 而不是 useRender
App肯定是进入render阶段了,不然不会打印出来App render 1
,而是子组件child命中bailout没进入render阶段不会打印child render
详细的勘误内容
[89][最后一行] “按位与” => "按位或"
错误:HostRootFiber.current !== null
正确:HostRootFiber.alternate !== null
会完成自下而上的subtreeFalgs标记过程,那么commit阶段的三个子阶段会完成'自下而上'的subtreeFalgs消费过程.
如果按照书中理解,第二个应该是‘自上而下’的样子?
错误:return '${name1()} 和 ${name2()}`;
正确:return `${name1()} 和 ${name2()}`;
这一块反复看了几遍,但是没能理解为什么React是应用级框架,而Vue是组件级框架?
会是Vue通过Proxy精准映射了自变量和组件的关系吗,而React是要全部diff一遍查找差异更新?
作者大大能举个例子解答疑惑吗? 感谢
const errorEffectUpdateQueue = hook.queue;
“倒叙遍历” -> "倒序遍历"
HostComponent的stateNode属性对应DOM元素
与之前的issue[102]类似
const propValue = newProps[propName];
重复声明了
小标题讲的是 commitXXXEffects_begin
,下文讲的也是 commitXXXEffects_begin
,而这里却写的是 commitXXXEffects_complete
详细的勘误内容:
没有找到「示例2-5」
详细的勘误内容
4.4章节,Mutation阶段
在react18.2.0中,已经没有commitMutationEffects_begin/complete
方法
直接在commitMutationEffects
方法中执行commitMutationEffectsOnFiber
方法
shouldYield (是否可中断)
建议改为“是否应该中断”,看过源码的人应该知道,要表达这个状态应该要,并且是强制要被执行的,“是否可中断” 会被没看过源码的读者理解为可选执行
NextJS 是不是应该叫服务端渲染框架?叫服务端框架的话感觉让人误解。
详细的勘误内容
<h1> style="...."> Sibling </h1>
h1后面的>应为空格
大致是在第18行,从“对于一次更新开始,当 beginWork 开始前,curent.lanes” 中的curent勘误错误
详细的勘误内容
useState与useRender会在render阶段执行updateReducer方法.
应该是useReducer吧
const alternate = fiber.alternate;
if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) {
// 省略代码
}
enqueueUpdate(fiber, queue, update, lane);
enqueueUpdate中会把lane合并到fiber.lanes和alternate.lanes,放在前面,就不会命中了吧
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.