An application's state is all its data at a point in time. Since we are usually concerned with the current app's state, we could rephrase this to the following: the state is an app's data as it is right now, resulting from the previous steps that our app took and based on functions inside the app responding to the user interacting with it.Â
So, what is it in our app that changes its state? Functions, of course. The user interacts with our app, which triggers functions to change the current state to some other state.
However, as our apps grow, it is not uncommon to have components nesting several levels deep. If we say that state is the source of truth for how our app should display on the screen at any given time, then it would be beneficial to us to make that source of truth as easy to reason about and as simple to work with as possible.
Unfortunately...