The Truth
When making applications of any kind there is a very important truth that while simple, seems to be a problem that pops up time and time again.
This truth is summed up in a tweet by Dan Abramov as shown below.
This is such an important concept that will ease a lot of pain when making any non-trivial application that I wanted to make a short blog post about it.
It practical terms, when making a React/React Native application, all state doesn’t necessarily have to live in the a Redux/Flux Store. State is allowed to be local to a component, however we have to make sure that the state that is held locally is not duplicated elsewhere, like in a store. Failing to do so will cause imminent synchronisation issues that will be hard to solve.
This principle of course applies to the native iOS and Android development that I also do. Although there may not necessarily be an equivalent Redux on these platforms, the idea that there should be a single source of truth that lives in a singleton or a view controller/activity for any particular thing still holds.