react-native-navigation的迁移库

remx-support-store.js 322B

12345678910111213141516171819
  1. import _ from 'lodash';
  2. import * as remx from 'remx';
  3. export const state = remx.state({
  4. person: {}
  5. });
  6. export const mutators = remx.setters({
  7. setName(newName) {
  8. state.person.name = newName;
  9. }
  10. });
  11. export const selectors = remx.getters({
  12. getName() {
  13. return _(state).get('person.name', 'no name');
  14. }
  15. });