react Flashcards

1
Q

What is React?

A

A JavaScript library for building user interfaces

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

How do you mount a React element to the DOM?

A

you use ReactDom.render(${element}, ${location you want to add it to)

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

What is a React Element?

A

an Object

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

What is JSX?

A

, JSX just provides syntactic sugar for the React.createElement(component, props, …children) function.

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

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

A

Because React must be in scorp from your jsx code, since JSX Compiles into calls to React.createElement

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

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

A

use the @babel/plugin-transfform-react-jsx

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

What is a React component?

A

components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what shoudl appear on teh screen

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

How do you define a function component in React?

A

either function {Name}(prop/object){
return <h1> Hello, {prop.name]</h1>
}

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

How do you mount a component to the DOM?

A

ReactDOM.render

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

What are controlled components?

A

An input form element whose value is controlled by React

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

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

A

onSubmit={} and onChange={}

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