Skip to content
New issue

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

[React] useRef 是如何实现的【热度: 299】 #813

Open
yanlele opened this issue Aug 10, 2024 · 0 comments
Open

[React] useRef 是如何实现的【热度: 299】 #813

yanlele opened this issue Aug 10, 2024 · 0 comments
Labels
TOP100互联网 公司标签 web框架 web 框架相关知识
Milestone

Comments

@yanlele
Copy link
Member

yanlele commented Aug 10, 2024

关键词:useRef 实现

该问题也是非常复杂, 需要深入源码, 可以看下面文章解析:

https://juejin.cn/post/7341757372188065792

以下是题库作者对上面文档的一些提炼总结

  • 什么是数据共享层
  • hooks
    • 如何确定 fiber 对应的 hook 上下文?
    • hook 是如何存在的?保存在什么地方?
    • 多个 hook 如何处理?
  • useRef
    • 实现原理
    • 标记 Ref​
    • 执行 Ref​ 操作
  • mount 该如何操作
  • update 的时候该如何操作
  • 整体执行流程
    • 标记
    • 执行
@yanlele yanlele added TOP100互联网 公司标签 web框架 web 框架相关知识 labels Aug 10, 2024
@yanlele yanlele added this to the 资深 milestone Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TOP100互联网 公司标签 web框架 web 框架相关知识
Projects
None yet
Development

No branches or pull requests

1 participant