[英]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.