React-Redux Flashcards

1
Q

What is Redux?

A

Redux is a state management framework. There’s only 1 way of changing the ‘state’; through an action dispatch. Pros: predictable state, easier debugging.

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

What is React?

A

React is a front-end framework. React uses a virtual DOM to keep track of components.

  1. JSX - allows mixing html and javascript together
  2. components - reusability, modular
  3. Virtual DOM - renders select components, not entire page.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are lifecycle methods?

A

https://engineering.musefind.com/react-lifecycle-methods-how-and-when-to-use-them-2111a1b692b1

Lifecycle methods are a series of methods inherent to every component cycle. (Birth to death). They allow you to hook into a component’s life cycle stage, and control what happens next.

Use cases of lifecycle methods:
1 ) componentWillMount
2) componentDidMount
“You can’t guarantee the AJAX request won’t resolve before the component mounts. If it did, that would mean that you’d be trying to setState on an unmounted component, which not only won’t work, but React will yell at you for. Doing AJAX in componentDidMount will guarantee that there’s a component to update”
Use cases: AJAX calls, setState
3) componentWillReceiveProps
“component receives props that was not directly passed down originally. It is not called on initial render”
A) Check which props will change
Use cases: componentDidMount AJAX calls, then sometime later the props being passed in changes
4) shouldComponentUpdate
“Called after componentWillReceiveProps. By default, returns true, but we can customize it. Function args (nextProps,nextState) –> changing props or setState called.
5) componentWillUpdate
6) componentDidUpdate
7) componentWillUnmount

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

What is Thunk?

A

Thunk is a redux middleware, and it allows you to delay the dispatch of an action. It allows dispatcher to handle functions as objects. Main purpose is for async actions.

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