如何在React National中使用MOBX解决此误差



我正在尝试使用mobx在React Angand App中组织所有状态,但是我在下面的商店中读取了'null'的属性" bindings"。

import { observable } from 'mobx';
class RestaurantStore {
 @observable
 name = 'コンビニ屋';
 @observable
 tag = 'ショッピング';
 @observable
 shortDescription = '$10以上のお買い上げでスタンプ1個';
}
export default RestaurantStore;

你能帮我吗?

在下面添加我的软件包。

 "dependencies": {
 "@babel/plugin-proposal-class-properties": "^7.3.4",
 "@babel/plugin-transform-flow-strip-types": "^7.3.4",
 "@expo/vector-icons": "^9.0.0",
 "expo": "^32.0.0",
 "firebase": "^5.8.1",
 "mobx": "^5.8.0",
 "mobx-react": "^5.4.3",
 "react": "16.5.0",
 "react-native": "https://github.com/expo/react-native/archive/sdk-    
  32.0.0.tar.gz",
 "react-native-maps": "^0.23.0",
 "react-native-modal": "^7.0.2",
 "react-native-vector-icons": "^6.1.0",
 "react-navigation": "^3.0.9"
},
 "devDependencies": {
 "@babel/plugin-proposal-decorators": "^7.3.0",
 "babel-eslint": "^10.0.1",
 "babel-preset-expo": "^5.0.0",
 "babel-preset-react-native": "^4.0.1",
 "directory": "^0.1.0",
 "eslint": "^5.12.0",
 "eslint-config-airbnb": "^17.1.0",
 "eslint-plugin-import": "^2.14.0",
 "eslint-plugin-jsx-a11y": "^6.1.2",
 "eslint-plugin-react": "^7.12.3",
 "metro-react-native-babel-preset": "^0.53.0"
},

尝试此格式

import { observable, action, computed, toJS , decorate} from "mobx";
class RestaurantStore{
  name = 'コンビニ屋';
  tag = 'ショッピング';
  shortDescription = '$10以上のお買い上げでスタンプ1個';
}
export default decorate(RestaurantStore, {
  name: observable,
  tag: observable,
  shortDescription: observable
});

相关内容

  • 没有找到相关文章

最新更新