react-native-navigation的迁移库

MyStore.js 418B

123456789101112131415161718192021222324252627282930313233
  1. const remx = require('remx');
  2. const state = remx.state({
  3. person: {
  4. name: 'no name'
  5. }
  6. });
  7. const setters = remx.setters({
  8. setName(newName) {
  9. state.person.name = newName;
  10. },
  11. setAge(age) {
  12. state.person.age = age;
  13. }
  14. });
  15. const getters = remx.getters({
  16. getName() {
  17. return state.person.name;
  18. },
  19. getAge() {
  20. return state.person.age;
  21. }
  22. });
  23. module.exports = {
  24. setters,
  25. getters
  26. };