ACA 400 Week 6

Take “Action” in Redux

Sean Yager
2 min readSep 15, 2020
Photo by Jakob Owens on Unsplash

Discuss in words something you learned in class today or this week.

Week 6 has been all about Thunk, a Redux middleware that allow us to asynchronously interact with the store. Without Thunk, a typical Redux store uses/dispatches “actions” to update date in the store. So what’s a thunk?

As simple as it gets, a thunk is a function, wrapping an expression to delay it’s evaluation. (and that’s taken directly from the Thunk git repo)

What are “actions” in Redux?

Actions are use-able formula, they typically contain multiple lines of code (this could be variables or functions or committing of mutations). Actions are logic that can be executed and reused to perform tasks in your Redux app.

What is the role of reducers in Redux?

Reducers take our many different actions and compile them into a “reduced” switch statement that routes the actions we make. Actions describe what should happen and the switch statement contains what will happen to the state of our app.

What is the meaning of “single source of truth” in Redux.

Single source of truth refers to our store, where the data of our app lives. Think of the store like complicated a grocery list, it has toothpaste, and breakfast burritos, and seedless grapes, etc. If you’re like me, your grocery list is written on scraps of paper strewn about the house, which is not ideal.

Redux state (the single source of truth) is like if all those pieces of paper could talk to each other and conspire to combine themselves into a giant grocery list that has no duplicates. By having a single location for data to exist there’s no chance the data will be accidentally manipulated to the wrong value or exist in multiple places with multiple values. It’s clean!

Explain the components of Redux.

Components are exactly what they sound like, they are the building blocks of Redux. What are they though? Dan Abramov can run circles around me describing the ins and outs of Redux component structure, so rather than restate his words here I’ll link the documentation to Redux. The bits about Presentational and Container components may be what this question is getting at.

Which (if there is) node library method could you use to solve the algorithm problem you solved last night in your pre-homework.

The cursed question, so vague and non parse-able. Wish I could know what this question is possibly asking me, I ache to actually answer this algorithm ask.

And that’s all folks.

Austin Coding Academy

--

--

Sean Yager

Comics artist and web developer located in Austin, TX telling stories and making up fantasy worlds for fun.