-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
.d.ts文件版本问题 @types\reflux #525
Comments
The error appears to be related to TypeScript? I don't think the definitions at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/reflux have been updated yet for version 6 of reflux. Also in version 6+ of Reflux you'll probably need to put your values inside the state object. This is how I would updated it: class StatusStore extends Reflux.Store {
constructor() {
super();
this.listenables = pageAction;
this.state = {
page: location.hash.replace('#', ''),
hashHistory: []
}
}
onPush(newPage) {
if (this.state.page === page) {
return false;
}
LeftMeunAction.hide();
var prevPage = this.state.page;
/*
Note: you should also clone hashHistory (treat it as immutable) if you need to detect changes in React components,
for example state.hashHistory.length !== nextState.hashHistory.length in shouldComponentUpdate
JSON.parse(JSON.stringify()) is a hack to clone an object, but there are other ways to do that :)
*/
var historyClone = JSON.parse(JSON.stringify(this.state.hashHistory));
historyClone.push(prevPage);
this.setState({
page: newPage,
hashHistory: historyClone
});
}
} |
国际化 |
The type definition for Reflux v6.4 has been updated on Jun 26, 2018, it now supports the new class usage of Reflux. |
这样写是错误的
The text was updated successfully, but these errors were encountered: