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 is what gets returned from components. It’s an object that virtually describes the DOM nodes that a component represents. With a function component, this element is the object that the function returns.

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

by rendering it / ReactDOM.render(var you want to render , where you want to render it)

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

What is Babel?

A

Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript 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

is a software component that adds a specific feature to an existing computer program. When a program supports plug-ins, it enables customization.[1]

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. They allow you to pre-process files as you import or “load” them. Thus, loaders are kind of like “tasks” in other build tools and provide a powerful way to handle front-end build steps.

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

you’ll need to add the babel-loader to the list of modules

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

What is JSX?

A

syntax extension for JS and it makes React elements / implementing react components in JS that look like HTML

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 is just sugar for createElement without react you cant use createElement

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 JavaScript?

A

in a webpack config file add a module rule to load jsx files by using the babel loader and give the babel loader the plugin to transform react

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

What is a React component?

A

Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. Conceptually, components are like JavaScript functions.

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

This function is a valid React component because it accepts a single “props” (which stands for properties) object argument with data and returns a React element. We call such components “function components” because they are literally JavaScript functions.

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(what,where)

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

What are props in React?

A

they are properties / arbitrary inputs /arguments passed into react components

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

by having the prop name = to

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

How do you create “class” component in React?

A

class name of class extends React.Component then have a method with what you want to return

17
Q

How do you access props in a class component?

A

by using this.props

18
Q

What is the purpose of state in React?

A

to represent info about a components current situation

19
Q

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

A

by passing a function

20
Q

What are controlled components?

A

An input form element whose value is controlled by React / React component that renders a form also controls what happens in that form on subsequent user input.

21
Q

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

A

this.state.value and onChange(callback to handle input)

22
Q

What Array method is commonly used to create a list of React elements?

A

map

23
Q

What is the best value to use as a “key” prop when rendering lists?

A

use a string that uniquely identifies a list item among its siblings OR an ID

24
Q

When does React call a component’s componentDidMount method?

A

immediately after a component is mounted (inserted into the tree)

25
Q

Name three React.Component lifecycle methods.

A

componentDidUpdate, componentDidMount(), componentDidUnmount

26
Q

How do you pass data to a child component?

A

through props