React & libraries Flashcards

1
Q

What’s the top level of your app, and what params does it take?

A

() => {

}

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

What does the top-level Router component do?

A

Updates its state when its history attr emits an event.

<router></router>

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

What attributes can you pass to ?

A

\

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

What arguments does Redux’s createStore() take?

A

createStore((state, action) => state, [initialState])
creates a store from a reducer and an initial state

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

What is Redux’s store API?

A

subscribe, dispatch, getState

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

What’s the signature for a middleware passed to applyMiddleware?

A

({ getState, dispatch }) => next => action

Each middleware should call next() with action… or maybe not, or maybe at a different time.

Previous middlewares will receive the next middleware’s “dispatch” function. The last will receive the original dispatch method.

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

You want to compose async behavior by dispatching a thunk. What should the thunk’s signature be?

A

(dispatch, getState) => Promise

body: fetch(url).then(data => {}, error => {}), and dispatch actions with the data.

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

compose? (not most recent major version of Redux)

A

Just a functional utility, composes funs left to right.
Use compose to combine store enhancers into a more powerful createStore.
compose(applyMiddleware(…middlewares), devTools(), persistState(), createStore)

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

React Router: what should you use instead of a tags?

A

link to=””

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

I want to pass multiple components to a <route>?</route>

A

Name them!

<route></route>

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

Manipulating class names:

Which package do you import?

What function does it bring in?

What attribute do you apply to the React component?

A

classnames

classNames

className

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

Redirect attrs?

A

<redirect></redirect>

<route></route>

<!-- `/profile/123` -> `/about/123` -->

<redirect></redirect>

<!-- `/profile/me` -> `/about-user/123` -->

<redirect></redirect>

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

If a Route has no path…?

A

It’ll look for path matches among children, and render them inside {this.props.children} of the parent component.

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