‫So NgRx is a state management solution,
‫a library that helps with managing state data
‫in your application
‫and a library that gives you a clearly defined way
‫of managing application state.
‫And that clearly defined approach
‫all starts with creating a store.
‫So once you have NgRx installed into your Angular project,
‫something we'll do in the next lectures of course,
‫you can, and you should, create a store, a data store,
‫a state store with NgRx,
‫because that is where your data will be stored
‫and managed by NgRx.
‫And that's also the place
‫to which your Components can reach out to to read that data.
‫So if a Component needs a certain piece of state,
‫if it needs some data,
‫and if it should update when that data changes,
‫it can read that data from that store
‫and it can listen to data changes
‫so that Angular can update the UI
‫as that data in that store changes.
‫And for reading that data,
‫and extracting that data from the store,
‫it can also leverage a concept called Selectors
‫which is a concept defined and introduced by NgRx.
‫And it's actually a totally optional thing
‫as you will learn in this section here.
‫And therefore, with help of this store
‫and these optional Selectors,
‫Components can get that globally managed state data.
‫With NgRx, you have that one central store
‫in your application that in the end
‫manages all the data used in your entire application
‫and your different Components can then get
‫the data they need from that store.
‫But of course, getting the data is just one thing.
‫Components also typically need
‫to change that data over time,
‫for example because a button was clicked
‫or a forum was submitted.
‫And NgRx also gives you a clearly defined,
‫standardized way of performing such data changes.
‫Because in the NgRx worlds, to change data in the Store,
‫your Components must dispatch actions,
‫which in the end describe the changes
‫that should be performed
‫and add any extra data that might be needed
‫to change the data in the Store.
‫And then those actions are picked up by so-called Reducers
‫which you define as part
‫of setting up this entire state management system.
‫And in those Reducers,
‫you then have the actual logic that gets triggered
‫based on those actions to change the data in the Store.
‫And of course, that's all pretty theoretical right now,
‫we'll see all these things in action
‫over the next lectures, of course.
‫Last but not least, there's also one other building block
‫in that NgRx world you should be aware of
‫and that would be Effects.
‫Effects are simply side effects, like for example,
‫HTTP requests that should be sent to a backend,
‫that should maybe also be triggered
‫when certain Actions occur
‫so that an Action, for example,
‫does not just lead to data in that Store being changed,
‫but maybe also in addition to an HTTP request
‫being sent to a backend.
‫So that's the big picture,
‫and it's probably not 100% clear yet,
‫but that's exactly why we're now going to explore
‫these different building blocks step by step
‫over the next lectures.