🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` class Skt extends React.Component { render(){ return( <button onClick={()=>this.props.onClick()}>{this.props.value}</button> ) } } class Bight extends React.Component { constructor(props){ super(props); this.state = { value: null } } handleClick(){ this.setState({ value:'X' }) } render(){ return( <div> <Skt onClick={this.handleClick()}>{this.state.value}</Skt> </div> ) } } class Game extends React.Component { getv(i){ return ( <Bight value={i}/> ) } render(){ const wen = 'xiayibu X' return( <div> <div>{wen}</div> <div> <div>{this.getv(0)}</div> </div> </div> ) } } ``` true ``` class Skt extends React.Component { render(){ return( <button onClick={()=>this.props.onClick()}>{this.props.value}</button> ) } } class Bight extends React.Component { constructor(props){ super(props); this.state = { value: null } } getv(i){ return ( <Skt value={this.state.value} onClick={()=>this.handleClick(i)} /> ) } handleClick(){ this.setState({ value:'X' }) } render(){ return( <div> <div>{this.getv(0)}</div> </div> ) } } class Game extends React.Component { // getv(i){ // return ( // <Bight value={i}/> // ) // } render(){ const wen = 'xiayibu X' return( <div> <div>{wen}</div> <div> <Bight /> </div> </div> ) } } ``` false ``` getv(i){ return ( <Skt onClick={this.handleClick()} value={this.state.value}></Skt> ) } ``` true ``` getv(i){ return ( <Skt onClick={()=>this.handleClick()} value={this.state.value}></Skt> ) } ```