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(墙)

四、附录

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

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

相关推荐
观望过往1 天前
Spring Boot 与 RabbitMQ 集成示例
spring boot·rabbitmq·java-rabbitmq
刘一说1 天前
Spring Boot 中的消息队列集成:从 RabbitMQ 到 Kafka 的深度实践
spring boot·rabbitmq·java-rabbitmq
q***47181 天前
解决 Tomcat 跨域问题 - Tomcat 配置静态文件和 Java Web 服务(Spring MVC Springboot)同时允许跨域
java·前端·spring
小何开发1 天前
Springboot-WebService 服务端发布与客户端调用
java·spring boot·后端
Q_Q5110082851 天前
python+django/flask的图书馆管理系统vue
spring boot·python·django·flask·node.js·php
q***69771 天前
Spring boot启动原理及相关组件
数据库·spring boot·后端
q***46521 天前
Spring Boot 整合 Keycloak
java·spring boot·后端
LSL666_1 天前
spring多配置文件
java·服务器·前端·spring
Wayfreem1 天前
Spring AI Alibaba 学习之最简单的快速入门
人工智能·学习·spring