REACT Flashcards

1
Q

What is JSX?

A

a syntax extension to JavaScript used with React to describe what the UI should look like

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

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

A

JSX is just syntactic sugar for react elements and depend on the React.createElement method.

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

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

A

add the babel-loader to the list of modules in the webpack config obj

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

What is a React component?

A

a single section of the UI represented as a JS function that returns React elements

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

How do you define a function component in React?

A
just like a regular JS function: Must be capitalized.
function Name(props){
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you mount a component to the DOM?

A

ReactDOM.render(, root);

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

What are props in React?

A

props is the property object which holds property values of that React element

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

How do you pass props to a component?

A

specify the prop name = “property”

ex)

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

How do you write JavaScript expressions in JSX?

A

use curly braces {props.text}

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