Title: Angular / Ngrx

Q: What is Redux?
A: Redux is a global state of data that is outside your framework.

Q: What is Ngrx?
A: It is a bunch of libraries that helps build reactive applications in Angular and implements redux in the Angular way.

Q: Why use Ngrx store for state management?
A: When you have a lot of user interactions and services and managing state in services in no longer sufficient.

Q: `Ngrx` state management lifecycle:
A: - A component triggers an action,
- Action calls the service for new data.
- Service calls action with the new data.
- Action passed the data to a reducer.
- Reducer updates the store with the new data.
- Store activates the selectors with the new data.
- Components registered to the selectors update their state.

Q: What is an action in `Ngrx`?
A: An action is a simple interface with a property called type that is a string.

Q: What is the purpose of the `createAction` function in `Ngrx`?
A: It helps us create an action.

Q: What can you pass as parameters to  the `createAction` function in `Ngrx`?
A: - The global name of the action.
- Provide additional properties to handle any additional metadata.

Q: What is the standard format for naming `Ngrx` actions?
A: Include a namespace in the name of your action something like `[Auth] Register` or `[Auth] Login` where `[Auth]` is the namespace for the action.

Q: Why must we also include a namespace while naming our `Ngrx` actions?
A: Because all actions are global.

Q: What is a `Validator`?
A: A validator is a function that processes a `FormControl` or collection of controls and returns an error map or null.
A null means that the validation has passed.

Q: What is `updateValueAndValidity()`?
A: When you add or remove a validator at run time, you must call`updateValueAndValidity()`  function for the new validation to take effect.

Q: What does the following function do?
```
export const register = createAction(
  '[Auth] Register',
  props<{request: RegisterRequestInterface}>()
);
```
A: It creates an action called register and props which can be used to pass data to the action.

Q: What does the following code do?
`this.store.dispatch(register({request}));`
A: It dispatches an action to the store. In this case the register action with a request parameter.

Q: What does `provideStore` do in the following application?
```
bootstrapApplication(AppComponent, {
  providers: [provideRouter(appRoutes), provideStore()],
});
```
A: It initializes the single store object for the application.

Q: Which `Ngrx` library provides redux dev tools?
A: `@ngrx/store-devtools`