react-native-navigation的迁移库

component.js 624B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { Text } from 'react-native';
  2. import React, { Component } from 'react';
  3. import { connect } from 'remx/react-native';
  4. import { selectors } from './store';
  5. class MyContainer extends Component {
  6. constructor(props) {
  7. super(props);
  8. this.renders = 0;
  9. }
  10. render() {
  11. this.renders++;
  12. if (this.props.printAge) {
  13. return this.renderAge();
  14. } else {
  15. return this.renderName();
  16. }
  17. }
  18. renderName() {
  19. return (
  20. <Text>{selectors.getName()}</Text>
  21. );
  22. }
  23. renderAge() {
  24. return (
  25. <Text>{selectors.getAge()}</Text>
  26. );
  27. }
  28. }
  29. export default connect(MyContainer);