wangbinyq / personal-wiki

2 stars 0 forks source link

how to build your own react #14

Closed wangbinyq closed 6 years ago

wangbinyq commented 7 years ago

Why

You want to known React in depth? It is the chance to build your own react.

API

React have a minimalist API. The main APIs we use are render, createElement and Component with lifecycle. Those are all we need to have a React implementation.

render

diff

component

Component is a kind of special node type. It have it's own lifecycle, we need to integrate Component to diff algorithm and make it associated with dom node.