编程与软件工程pomb.us编辑精选
从零构建自己的 React
Build Your Own React
2019 — 2025,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是一篇广为流传的逐步教程,带你从零手写一个简化版 React,依次实现 createElement、render、Fiber 调度和 Hooks 等核心机制,从而理解 React 的内部工作原理。文章以渐进展开的代码演示形式呈现,阅读体验出色。
为什么经久不衰:它把框架的“魔法”拆解成可动手复现的代码,让人明白库并非魔法、未必需要庞大的依赖,这种启发至今仍然适用。
HN 评论精选
称赞文章,并指出作者的代码演示库 Code Surfer 已开源
非常非常棒。而且他用的演示库也开源了!(codesurfer.pomb.us)
leetrout查看英文原文
Very, very nice. His presentation library is available as well! https://codesurfer.pomb.us/ https://github.com/pomber/code-surfer/blob/code-surfer-v2/readme.md
自己动手实现能破除对库的迷信,让人意识到未必需要引入庞大的依赖
演示效果令人惊叹。我最近写了一个基于 web component 的路由,惊讶于很少的代码就能做到相当可用。我常常陷入 `npm i` 的惯性——明明需要的只是所引入的庞大库中很小一部分功能。Rodrigo 说得对,这类实践能帮你理解 React、为它贡献代码,但意义不止于此——它让你明白库并不是魔法,给你信心去想:也许我并不需要那个 560KB 的完整库。
jjcm查看英文原文
Presentation is amazing here. That said, I recently wrote a webcomponent based router and I was surprised at how easy it was to get to a very usable point at such a minimal amount of code. All too often I get in the loop of just `npm i`'ing whatever it is I need, even if the functionality I really need is just a tiny subset of whatever huge library I'm importing. Rodrigo's right that something like this helps you understand React and how to contribute to the codebase, but I think it goes further than that - it lets you understand that the library isn't magic. It gives you the confidence you need to think that maybe you don't need that full 560kb library.
文章的渐进式代码演示形式本身就很吸引人
先不管自己写 React 了,我更想复刻你这种演示形式!这个创意太棒了!
jaequery查看英文原文
Forget building my own React, I want to build how you did the presentation! It’s a great concept!
补充相关资源:Sophie Alpert 关于自定义 React 渲染器的演讲
类似地,Sophie Alpert 在 React Conf 上做了一个演讲,讲如何通过实现 React 暴露的接口来打造自定义渲染器。她解释了如何把 React 当作几乎任何平台的声明式 API 来使用,就像 react-native 那样。
level查看英文原文
Along a similar vein, Sophie Alpert did a talk[1] at React Conf this year on building your own React custom renderer by using implementing the interfaces that React exposes. Sophie explains how you could use React as a declarative API for pretty much any platform if you wanted, similar to how react-native works. [1] https://www.youtube.com/watch?v=CGpMlWVcHok
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选