1.0.6 • Published 5 years ago

copy-react v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

copy-react

学习 react 并且造一个简易 react 为 copyReact, 编译 .copy 文件

Study react and copy it

why

学习 react 的原理。

want to learn principle for react...

install

npm i copy-react --save

use

main.copy

import Copy, {CopyComponent} from 'copy-react'

class Demo extends CopyComponent {
    constructor(props) {
        super(props);
        this.state = {
            num: 1
        };
    }

    handle = () => {
        this.setState({
            num: this.state.num + 1
        })
    };

    render() {
        return (
            <div id='container'>
                <input type='text' value='foo' />
                <a href="javascript:void(0)" onClick={this.handle}>点我加一</a>
                <span>数字😁: {this.state.num}</span>
            </div>
        )
    }
}

export default Demo;

index.copy

import Copy, { CopyRender } from 'copy-react';
import Demo from './index.copy'

CopyRender(<Demo />, document.getElementById('root'));

note

Compile .copy

link: https://www.npmjs.com/package/babel-preset-copy

example

link: https://github.com/Lemenxzy/Copy-React

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago