React源码学习(一):如何学习React源码

本系列源码学习,是基于 v16.13.1,v17.x与v16.x区别并不太大!

一、如何正确的学习React源码?

  1. 找到Github,转到React仓库,fork / clone源码:React
  2. 查看Readme,在Documentation中有Contributing Guide(参与贡献指南)
  3. 点击跳转后,在"Development Workflow"中有如下一段话:

The easiest way to try your changes is to run yarn build react/index,react-dom/index --type=UMD and then open fixtures/packaging/babel-standalone/dev.html. This file already uses react.development.js from the build folder so it will pick up your changes.

最简单的方法就是先 git 下载 react 官方源码,然后编译成 UMD 库,再使用 fixtures/packaging/babel-standalone/dev.html,这个文件默认使用 react.development.js

我们可以修改react源码,然后build,再打开/刷新dev.html(也可以自己demo),就能学习了。

二、流程步骤:

  1. fork / clone source code;
  2. 进入根目录;
  3. yarn (国内情况...也许要墙);
  4. yarn build react/index,react-dom/index --type=UMD

三、关注官方资源

【React官方博客】

Dan Abramov 最近在 JSConf 上对 React 未来的一些新特性的介绍 - Beyond React 16(墙)

四、附录

【达人分享】
【其它博客】

喜欢的朋友记得点赞、收藏、关注哦!!!

相关推荐
蒂法就是我10 分钟前
策略模式在spring哪里用到了?
java·spring·策略模式
踏浪无痕1 小时前
Nacos 配置刷新踩坑:复杂嵌套 Map 为什么刷不上?
spring boot·微服务
摇滚侠1 小时前
HTML5,CSS3,开启浮动布局后,主轴和侧轴的概念
前端·css3·html5
w***48822 小时前
Spring Boot3.x集成Flowable7.x(一)Spring Boot集成与设计、部署、发起、完成简单流程
java·spring boot·后端
后端小张2 小时前
【JAVA 进阶】Spring Cloud 微服务全栈实践:从认知到落地
java·开发语言·spring boot·spring·spring cloud·微服务·原理
李昊哲小课2 小时前
SSM框架完整教程
spring boot·spring·spring cloud
MC丶科3 小时前
Spring Boot + RabbitMQ 实现异步消息处理(订单通知、邮件发送)!告别同步阻塞“噩梦”
spring boot·rabbitmq·java-rabbitmq
y***61318 小时前
【springboot】Spring 官方抛弃了 Java 8!新idea如何创建java8项目
java·spring boot·spring
黄昏恋慕黎明9 小时前
spring MVC了解
java·后端·spring·mvc
Filotimo_11 小时前
SpringBoot3整合Druid数据源
java·spring boot