简体   繁体   English

将Reflux商店迁移到ES6语法

[英]Migrating Reflux Stores to ES6 syntax

I have been trying to refactor Some existing React-Reflux code to ES-6 syntax, 我一直在尝试将一些现有的React-Reflux代码重构为ES-6语法,

I have 3 Stores for people, Projects and events. 我有3家商店供人们,项目和活动使用。 They Do basically the same thing but call different apis to fetch results. 他们基本上做相同的事情,但是调用不同的api来获取结果。

so I tried to do the following : 因此,我尝试执行以下操作:

class ResultStore extends Reflux.Store {
    constructor(resultsAPI){
        super();
        //initializations
    }
}
class PeopleResultStore extends ResultStore {
    constructor(){
        super('peopleBySkill');
    }
}

But this started throwing error "Super expression must either be null or a function, not undefined" at random places (mostly at Export statements of totally unrelated stores) in the code base. 但是,这开始在代码库中的随机位置(主要是在完全不相关的存储的Export语句中)引发错误“超级表达式必须为null或函数,且未定义”。 I'm using version 0.14.3 of React and 0.3.0 of Reflux 我正在使用React的0.14.3版本和Reflux的0.3.0版本

Reflux.Store and Reflux.Component for ES6 usage are just now newly implemented features that can be used in Reflux. Reflux.Store用于ES6的Reflux.StoreReflux.Component是新实现的功能,可以在Reflux中使用。 The page you previously mention was just someone mentioning they want a feature like that. 您之前提到的页面只是有人提到他们想要这样的功能。 It had not been implemented at the time, and the things discussed on that page are not necessarily reflective of exactly how it was implemented. 当时尚未实施,该页面上讨论的内容不一定完全反映了实施方式。

The documentation of how they are currently implemented is here: https://github.com/reflux/refluxjs#react-es6-usage 当前如何实现它们的文档在这里: https : //github.com/reflux/refluxjs#react-es6-usage

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

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