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

what is a React element?

A

a react element describes what you want to see on the screen

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(element, container[, callback])

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

what is babel?

A

a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JS in current and older browsers or environments

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

what is a plug-in?

A

a software component that adds a specific feature to an existing computer program, enabling customization

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

what is a webpack loader?

A

loaders are transformations that are applied to the source code of a module

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

how can you make babel and webpack work together?

A

npm install babel loader

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

what is JSX?

A

a syntax extension to JavaScript

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

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

A

JSX pulls from React

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

how can you make webpack and babel work together to convert JSX into valid JS?

A

npm install babel loader babel/plugin-transform-react-jsx react react-dom

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

what is a React component?

A

function and/or class that returns React elements

conceptually are like JS functions. they accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen

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

how do you define a function component in React?

A

capital first letter of function name

writes like a JS function

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

how do you mount a component to the DOM?

A

ReactDOM.render(element, container)

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

what are props in React?

A

Properties, are objects

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

How do you pass props to a component?

A

use properties as a parameter and embed as expression

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

how do you write JS expressions in JSX?

A

within { }

17
Q

how do you create “class” components in React?

A

Class declaration
capital first letter of class name
extends “React.Component”
render()

18
Q

how do you access props in a class component?

A

This

19
Q

what is the purpose of state in React?

A

State is a JS object that stores a component’s dynamic data and determines the component’s behavior

keep track of values of status of things at different points in time

20
Q

how do you pass an event handler to a React element?

A

as a prop, the prop starts with “on”, and event name is in camelCase