反复进出头条字节小程序,会出现组件间多个事件不存在



  • 父组件
    netWork = () => { }

    render() {
    return (
    <GetWifi
    ref={(ref) => { this.GetWifi = ref }}
    onNetWork={this.netWork.bind(this)}
    />
    )
    }

    子组件
    static propTypes = {
    onNetWork: PropTypes.func.isRequired,
    }

    this.props.onNetWork()

    _this.props.onNetWork is not a function;at pages/logs/logs onReady function;at api getNetworkType success callback function

    TypeError: _this.props.onNetWork is not a function
    Failed prop type: The prop onNetWork is marked as required in BaseComponent, but its value is undefined.


登录后回复