繁体   English   中英

如何将这个javascript类转换为react可以使用的东西?

[英]How can I convert this javascript class to something react can use?

const Component = require('../Component')

class PlayerComponent extends Component {
    constructor(uid, username){
        super('PlayerComponent');
        this.username = username;
        this.uid = uid;
    }
}

module.exports = PlayerComponent;

该文件夹位于我要在服务器和客户端上使用的名为shared的文件夹中,现在它在服务器上可以正常工作,但是我似乎无法弄清楚如何转换整个共享文件夹,因此我也可以在客户端。

您应该从客户端的React.Component继承。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM