Managing App State with Redux Flashcards

1
Q

What are action and action creators used for?

A

Changing the state of our application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the flow of an action?

A

Goes through all the reducers. Reducers can then use that action to produce a different value for its particular piece of state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is redux? Why is it different

A

We place all of the applications data inside a single object. State in redux is application level state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The application state is generated by what?

A

Reducers. Application state is an object, parts of the state are identified by key’s, values are created by the reducers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a container?

A

It is a re-act component that has a direct connection to teh state managed by redux. The only time we ever get braidge available where we can take a react component and inject state is a component we call container or ‘smart components’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give a process review up until containers and reducers

A

1) Redux serves to construct the application state and react provides the views to display
2) The two libraries are inherently disconnected and it’s only through the use of react-redux that we get a clear connection
3) Application state is generated by reducer functions
4) Added reducer to our combined Reducers call inside index.js in reducers folder
5) This reducer adds a key to global application states, and value is from
6) Created a component, and since it needed to be aware of state we promoted it to a container (smart component). We import connect function, define mapStateToProps and hooked up our container with the connect function and exported
7) Finally, we madsure App took our container and refreshed. Redux state object, mapped state as props to our component, redender with books. Container will rerender as application state changes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Walk through the process of whena user does an action

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Walkthrough reducers and actions

A

1) Redux is in charge of amanging application state. State is a single plain javascript object
2) Application state is different front component state
3) Reducers are application state, combined, and each key has a reducer and responsible for the piece of application state
4) Our reducers are in charge of changing app state through actions, each reducer has opportunity to return based on update
5) Action creators - functions that are actions, objects, actions must have a type defined with a payload

How well did you know this?
1
Not at all
2
3
4
5
Perfectly