React Flashcards

1
Q

What is React?

A

Framework for creating interactive UI for webpages

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

What is a React element?

A

an object representation of a virtual DOM node.

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

How do you mount a React element to the DOM?

A

render( )

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

How do you mount a component to the DOM?

A

render ( )

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

What are props in React?

A

a type of object where the value of attributes of a tag is stored.

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

How do you pass props to a component?

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

How do you write JavaScript expressions in JSX?

A

In { }

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

What are controlled components?

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

What two props must you pass to an input for it to be “controlled”?

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

What is a React Effect?

A

A way to tell React that your component needs to do something after render/mount.

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

When should you use an Effect and when should you not use an Effect?

A

Effects are an escape hatch from the React paradigm. They let you “step outside” of React and synchronize your components with some external system like a non-React widget, network, or the browser DOM. If there is no external system involved (for example, if you want to update a component’s state when some props or state change), you shouldn’t need an Effect.

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

When do Effects run?

A

Without a dependency -> Every render. With a an empty array -> On mount With dependencies -> On mount and if dependency has changed.

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

What function is used to declare an Effect?

A

useEffect( ( ) => { } )

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

When does the clean up function run

A

Before the effect is run again and when you unmount.

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

What does fetch() return?

A

A Promise that resolves to a Response object.

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

What is the default request method used by fetch()?

A

GET

17
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

With the method property