Skip to content
项目

关于

⚛️ React done in 160 lines of JavaScript.

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Gooact

Copyright 2018 SweetPalma <[email protected]>

Own React in 160 lines of JavaScript - repository for Medium article code: https://medium.com/@sweetpalma/gooact-react-in-160-lines-of-javascript-44e0742ad60f

Introduction

React is a great library — many developers instantly fell in love with it due to simplicity, performance and declarative way of doing things. But personally I have a specific reason what makes it so special for me — and that’s how it works under the hood. I find ideas that stand behind React simple yet strangely fascinating — and I believe that understanding its core principles would help you writing faster and safer code.

So I write a Medium article where how to write a fully functional React clone, including Component API and own Virtual DOM implementation. This is a public repository of Gooact itself.

Installation & Usage

This is a standalone version of Gooact - it can be installed with NPM:

npm install sweetpalma/gooact

And used just as a regular JavaScript library:

import Gooact, {render, Component} from 'gooact';

Due to its nature, Gooact can consume JSX - just don't forget to hook up the Babel together with React preset:

/** @jsx Gooact.createElement */
render(<div>Hello World!</div>, document.getElementById('root'));

Notice that @jsx pragma comment - without it Babel will fail to tie proper element factory function. Check example folder for a bigger snippet.

License

Gooact is licensed under the MIT License, what allows you to use it for basically anything absolutely for free. It would be great if somebody will find it useful.

探索相关项目

加载中…