React Flashcards

1
Q

What is a React element?

A

React element is an object that’s describes DOM node.

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

What is Babel?

A

Babel is a tool(complier) to convert ECMAScript 2015 code into a backwards compatible version.

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

What is a Plug-in?

A

Plug-in is a software that ads specific feature to an existing computer program

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

What is a Webpack loader?

A

Webpack loader is a plugin which transforms source code of module.

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

How can you make Babel and Webpack work together?

A

By using loader as plugin in webpack config.js (babel loader)

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

What is JSX?

A

It’s XML style extension to JavaScript language

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

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

A

It needs to be available so we can call method on it.
This refers to - import React from ‘react’

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

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

A

To convert JSX into valid JavaScript we use plugin react jsx.

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

Adding is as a first parameter into ReactDOM.render method, second is DOM element where to mount it.

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

What are props in React?

A

Props in React are objects. Props are arguments pass to 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

We pass props to a component as key:value -> name=”Max”

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

Between curly bracers

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

How do you create “class” component in React?

A

Using keyword class MyComponent extends React.Component{ return () { content }}

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

How do you access props in a class component?

A

using this.props

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

What is the purpose of state in React?

A

It’s like data model, when you update it react change website

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

How you pass an event handler to a React element?

A

you pass event handler as a prop

17
Q

What are controlled components?

A

Input elements that are controlled by react

18
Q

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

A

value and onChange

19
Q

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

A

Map method

20
Q

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

A

Whatever is unique should be use as a key, (id)

21
Q

When does React call a component’s componentDidMount method?

A

Immediately after first render (inserted into DOM tree

22
Q

Name three React.Component lifecycle methods.

A

ComponentDidMount, ComponentDidUpdate, render, constructor

23
Q

How do you pass data to a child component?

A

As a props, from main component

24
Q

What are React Hooks?

A

React Hooks are functions. Let as use state and other features in the functional components.