REACT Flashcards

1
Q

What is React?

A

a JS library/framework for building user interfaces

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

What is a React element?

A

a JavaScript Object that describe what a DOM element should loop like

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

calling root.render(element)

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

what is the difference between a library and a framework

A

inversion of control

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

What is Babel?

A

a javascript compiler that can convert modern JS or other plugins to something more backwards compatible

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

What is a Plug-in?

A

external software add-ons that help customize stuff

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

What is a Webpack loader?

A

it runs through code and turns it into backwards compatible JS before sending it to Webpack

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

How can you make Babel and Webpack work together?

A

by downloading babel-loader from NPM

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

What is JSX?

A

a syntax extension for JS to work with REACT to help structure the UI

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

Why must the React object be imported when authoring JSX in a module?

A

because JSX produces REACT elements

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

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

with architecture plugins

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

What is a React component?

A

a function or class that returns or defines a react element

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

How do you define a function component in React?

A
function Name(props) {
    return 
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you mount a component to the DOM?

A

query for an anchor point, assign it as a root of ReactDOM,

call root.render() and pass as the argument

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

What are props in React?

A

objects

arbitrary imputs(arguments) for react components

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

How do you pass props to a component?

A

by defining them as a key: value pair inside the react element

17
Q

How do you write JavaScript expressions in JSX?

A

inside curly braces

18
Q

How do you create “class” component in React?

A

class ‘name’ extends React.component {
prototypes
}

19
Q

How do you access props in a class component?

A

this.prop.name

20
Q

What is the purpose of state in React?

A

to track changes over time

21
Q

How to you pass an event handler to a React element?

A
22
Q

What are controlled components?

A

an input form element who’s value is controlled by React

23
Q

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

A

value and onChange handler

24
Q

What Array method is commonly used to create a list of React elements?

A

map

25
Q

What is the best value to use as a “key” prop when rendering lists?

A

a unique identifier

26
Q

When does React call a component’s component.didMount method?

A

immediately after the component is rendered into the DOM tree

27
Q

Name three React. Component lifecycle methods.

A

component. didMount(), component.didUpdate(),

component. willUnmount()

28
Q

How do you pass data to a child component?

A

as a prop