What is state and how is it different from props?
Every React Native application is created to display some sort of data. It can be weather data, images, market data, maps… Using React Native, we manage how this data is displayed on our users’ screens. React Native offers robust tools for styling and animating content. However, in this book, we are concentrating on the raw material of data used in your app.
In order to have a dynamic piece of data, existing automagically in sync with our component, we need to declare the list as a component state.
Important note
The most important thing to remember about state is this: state is managed within the component; it is the component memory.
Any changes in state will cause your component and all its children to re-render. This is an expected behavior: if your data changes, you want your UI to change as well. However, multiple component re-renders may cause your app to encounter performance issues.
Let’s...