SOURCE

console 命令行工具 X clear

                    
>
console
class Toggle extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            isToggleOn: false
        }
    }

    handleClick = () => {
        this.setState(state => ({
            isToggleOn: !state.isToggleOn
        }))
    }

    render() {
        return (
            <button onClick={this.handleClick}>
                {this.state.isToggleOn ? 'OFF' : 'ON'}
            </button>
        )
    }
}
ReactDOM.render(
    <Toggle />,
    document.getElementById('root')
)
<div id="root">
    <!-- This element's contents will be replaced with your component. -->
</div>

本项目引用的自定义外部资源