読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

React三銃士を連れてきたよ

React

書捨て。

props

http://qiita.com/koba04/items/bc13d1f42964278ae14e

    getInitialState: function () {
        return {
            isPressed: false,
            isHovered: false
        }
    },
    getDefaultProps() {
        return {
            label: "React"
        };  
    },

click event

http://qiita.com/koba04/items/bf8d02a2d0589e9247a7

    click () {
        this.setState({
            isPressed: true
        });
    },
....
<button onClick=${this.click}></button>

hover event

http://stackoverflow.com/questions/28072196/a-hover-button-in-react-js

    mouseOver: function () {
        this.setState({
            isHovered: true
        });
    },
    mouseOut: function () {
        this.setState({
            isHovered: false
        });
    },
....
<button
                   onMouseOver={this.mouseOver}
                   onMouseOut={this.mouseOut}>{this.props.label}</button>;