Code Monkey home page Code Monkey logo

melon's Introduction

Melon

这个项目的目的是通过自己实现一个virtual-dom,有助于更好的理解React这类库的底层原理。

详细讲解

Installation

npm install

npm start

open localhost:3003

Example

//定义一个组件
let MyButton = {
	render: ({props, children}) => 
		<button onClick={addCount} {...props}>{children}{count}</button>
}
let count = 0
let addCount = () => {
	count++
	app()
}
//渲染函数,用来生成dom
let render = createApp(document.body)

let app = () => {
	render(<MyButton className="button">hello, button</MyButton>)
}

app()

Thanks

参考文献:

License

MIT

melon's People

Contributors

jjvvv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

caracal7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.