SOURCE

console 命令行工具 X clear

                    
>
console
class Toggle extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
        names: ['小红', '小明', '小李']
    };

    // This binding is necessary to make `this` work in the callback
    // this.handleClick = this.handleClick.bind(this);
  }

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

  render() {
      let a = this.state.names.map((number) =>{
          return <li key={number}>{number}</li>
      })
    return (
        <div>
            <ul>
                {a}
                { this.state.names.map((number) =>{
                    return <li key={number}>{number}</li>
                })}
            </ul>
        </div>
    );
  }
}



ReactDOM.render(
  <div>
    <Toggle />
  </div>,
  document.getElementById('root')
);
<div id="root"></div>

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