sqfbeijing / articles Goto Github PK
View Code? Open in Web Editor NEWPersonal articles written in Chinese.
Home Page: articles-sqfbeijing.vercel.app
Personal articles written in Chinese.
Home Page: articles-sqfbeijing.vercel.app
请看这个例子: https://github.com/sqfbeijing/articles/blob/master/assets/htmls/react-babel.html
/**
* 本例子说明: React17以前的版本会有此问题:
* 由于React事件是绑定在dom上的,而非「react-root」节点上,那么react事件必然会经过「main」节点(react-root和document之间的节点)
* 如果这些节点有原生js或者jqeury之类的代码阻止了事件冒泡,那么势必会影响React应用,引起bug
* 而React17不会再有此类问题。
*/
文章: https://www.bigbinary.com/blog/react-17-delegates-events-to-root-instead-of-document
https://github.com/acdlite/react-fiber-architecture 此文中将fiber类比于函数的调用栈,很多术语都使用调用栈的概念来进行类比。
- Reconciliation is the algorithm behind what is popularly understood as the "virtual DOM."
- The reconciler does the work of computing which parts of a tree have changed; the renderer then uses that information to actually update the rendered app. // 协调器计算哪些部分改变了,渲染器用这些信息进行更新app
- requestIdleCallback 在空闲期安排一个低优先级的函数进行执行,requestAnimationFrame: 安排在下一个动画帧上调用的高优先级函数, 但若想充分使用这2个api,前提是「break rendering work into incremental units」,能够可中断地增量更新,而非将函数调用栈完全执行完毕。
- Fiber: 可视为虚拟的堆栈帧。「You can think of a single fiber as a virtual stack frame.」
In concrete terms, a fiber is a JavaScript object that contains information about a component, its input, and its output.
A fiber corresponds to a stack frame, but it also corresponds to an instance of a component.
由于requestIdleCallback兼容性问题,所以官方自己实现react-scheduler(postmessage + requestAnimationFrame)来模拟requestIdleCallback。
brickspert/blog#26 React Hooks 原理
参考这篇文章,https://indepth.dev/posts/1007/the-how-and-why-on-reacts-usage-of-linked-list-in-fiber-to-walk-the-components-tree。 就是说用链表可以暂停组件的更新工作,并且在后续的某个时间段内恢复它。 React 会一直通过这种方式来遍历, 直到处理完所有的组件并且调用栈为空。
If you rely only on the [built-in] call stack, it will keep doing work until the stack is empty…Wouldn’t it be great if we could interrupt the call stack at will and manipulate stack frames manually? That’s the purpose of React Fiber.Fiber is re-implementation of the stack, specialized for React components. You can think of a single fiber as a virtual stack frame.
https://juejin.cn/post/6844903946222321671#comment
「react进阶」一文吃透react-hooks原理
https://github.com/BetaSu/react-on-the-way
https://www.sytone.me/build-your-own-react [译]Build your own react
https://pomb.us/build-your-own-react/
https://vimcoding.com/2020/08/09/%E6%9E%84%E5%BB%BA%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84React/
https://github.com/BUPTlhuanyu/ReactNote 源码图
使用协调器
https://github.com/facebook/react/tree/main/packages/react-reconciler
https://agent-hunt.medium.com/hello-world-custom-react-renderer-9a95b7cd04bc
https://juejin.cn/post/7010539227284766751#heading-0
https://github.com/7kms/react-illustration-series
react防止xss 攻击以及babel转义过程: https://www.zoo.team/article/xss-in-react
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.