react Flashcards

1
Q

What is JSX?

A

JSX is a syntax extension to JS

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

bc it gets transformed into react.create element

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

we need babel-loader and the babel plugin transform react jsx

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

What is a React component?

A

its a reusable piece of code

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

function keyword followed by the function name and return the JSX

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

using the reactDOM.render

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

What are props in React?

A

properties of the component

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

key value pair on jsx component that resembles an attribute

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

wrap them with curly brace

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

What is the purpose of state in React?

A

to let us manage changing data in an application

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

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

A

by using the on click attribute and set it to the method we want to handle

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

When does React call a component’s componentDidMount method?

A

when its first mounted

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

Name three React.Component lifecycle methods.

A

componentDidMount, componentDidUpdate, componentDidUnmount

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