simple react
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src 修改示例并更新README Apr 16, 2018
.babelrc 添加动态渲染示例 Mar 18, 2018
.gitignore chore: init Mar 12, 2018
LICENSE Initial commit Mar 12, 2018
README.md 修改示例并更新README Apr 16, 2018
index.html render Mar 14, 2018
package-lock.json render Mar 14, 2018
package.json 修复diffAttributes,更新依赖 Apr 16, 2018

README.md

simple-react

一个极简的React框架,用于说明React实现原理,请不要用于生产环境

实现了JSX,组件,生命周期,diff,setState等核心功能

相关文章

运行

git clone https://github.com/hujiulong/simple-react.git
cd simple-react
npm install
npm start

使用

为了简单起见,并没有分开库代码和应用代码,可以直接修改src/index.js来使用

// src/index.js
import React from './react'
import ReactDOM from './react-dom'

class App extends React.Component {
    render() {
        return <h1>Hello,World!</h1>;
    }
}

ReactDOM.render(
    <App />,
    document.getElementById( 'root' )
);

LISCENSE

MIT