React Flashcards

1
Q

What is React?

A

React is a JavaScript library for creating 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

It’s an object that virtually describes the DOM nodes that a component represents.

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

reactDom.Render

Store react element into a variable and include it in the element argument of the ReactDom.render

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

What is JSX?

A

a syntax extension to JavaScript. JSX produces React “elements”.

It’s used for implementing react components in javascript that look like HTML

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

If you forget to import React, it will be undefined and the createElement call will fail.

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

Install webpack and babel in terminal, create a build “webpack” script,

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

What is a React component?

A

Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.

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

Define it like any other function but takes in props for parameter have it return a tag with text content

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 and encase the component in a self closing tag with a root destination

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

What are props in React?

A

Props are arguments passed into React components

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

How do you pass props to a component?

A

Use name of the function and Name of the prop = “ “

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

How do you write JavaScript expressions in JSX?

A

Put the javascript in between curly braces and put it somewhere in jsx

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

What is the purpose of state in React?

A

It’s used represent an information about the component’s current situation.

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

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

A

Use premade attributes in JSX elements such as onClick

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