this.state = { count: 0 };
_incrementCount = () => {
this.setState(prevState => ({ count: prevState.count + 1 }));
}
标签:
react-native
相关问题
- React Native Inline style for multiple Text in sin
- How Do I Convert Image URI into Byte Expo
- ApolloClient from apollo-boost attemped to assign
- Implementing ssl pinning in a react-native applica
- React-Native: Enable Performance Monitor in produc
相关文章
- Why do we have to call `.done()` at the end of a p
- Remove expo from react native
- React Native - Dynamic Image Source
- “Unfortunately, app has stopped” error with buildi
- eslint Parsing error: Unexpected token =
- How to determine JS bottlenecks in React Native co
- How to override navigation options in functional c
- PanResponder snaps Animated.View back to original
state of a Component depend on The component's life circle. When your component unMount and reMount the state will be reset to your default value.
Thus, just store your count value outside your element. (AsyncStorage, Redux, Mobx, or just simple in your custom logic)
This is the correct behaviour. If you want to persist changes after page reload, use AsyncStorage to save it.