So what is state?
Let me give you some examples.
State for example are the ingredients we added to our burger,
that's part of our application state, the application state of our burger builder application.
The information, which ingredients we added is crucial because it determines what we need to render to
the screen,
how should our burger preview look like there?
It's also important behind the scenes when we store that burger on a server and we need to submit all
these ingredients in the HTTP request. Another example would be the question, whether the user is authenticated
or not,
that can be super important as it might determine the options we're showing in the menu or the access
we're granting to certain components.
Also interesting is UI statelike is a given modal open, is a backdrop open, should it be open?
That's super important too,
it's less about data like ingredients and user authentication is, it's more about our pure UI only
state.
It might only be relevant to one single component,
still this is also an example for a state, more of a local than an application wide state
but still, state determining what should get rendered to the screen and that is in its core what you
can boil it down to, state influences what you see on the screen.
So therefore our last example would be a list of blog posts which we render, which we might filter, where
we might need to know which of these posts were created by the user,
also important state we might need in our application.
And of course the list goes on and on,
you can add more and more examples here,
now these really just are some examples. What's now so complex about state?
Why do we need extra library for that?
Let's take a closer look.