tinyreact is tiny, simple and clear react-like lib. It will help you understand react better.
so first, let's play todoList written by tinyreact
npm install tinyreact --save
let's write 'Hello World':
- .babelrc
{
"presets": [
"es2015"
],
"plugins": [
["transform-react-jsx", {
"pragma": "createElement"// default pragma is React.createElement, we should change!
}]
]
}
-
npm install tinyreact --save
-
write your code like React
import Tinyreact, { createElement, Component } from 'tinyreact'
class HelloWorld extends Component {
render() {
return <div style={{ color: 'red' }}>Hello World</div>
}
}
Tinyreact.render(<HelloWorld/>, document.getElementById("root"))
- virtual-dom
- life-cycle
- SyntheticEvent
- batchUpdate
- high-performance virtual-dom
- fiber