React Flashcards

1
Q

What is Webpack?

A

a tool that bundles your javascript files/modules

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

How do you add a devDependency to a package?

A

install –save-dev

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

What is an NPM script?

A

a command that you can use to execute multiple command line commands

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

How do you execute Webpack with npm run?

A

npm run webpack

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

How are ES Modules different from CommonJS modules?

A

more compact, different syntax …

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

What kind of modules can Webpack support?

A

.

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

What is a React element?

A

an object

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

How do you mount a React element to the DOM?

A

ReactDOM.render(…)

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

What is Babel?

A

a toolchain used to convert ES6 code to older versions of it

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

What is a Plug-in?

A

adds a feature to an existing program

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

What is a Webpack loader?

A

transformations that allow you to pre-process files as you import(load) them

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

How can you make Babel and Webpack work together?

A

babel loader

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

What is JSX?

A

Syntax extension to JavaScript. Allows you to write HTML expressions in React

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

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

A

it is not in the native library.

JSX compiles to calls of the createElement method

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

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

A

need to install the babel transform-react-jsx plugin

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

What is a React component?

A

javascript function that is independent and reusable - returns a react element

17
Q

How do you define a function component in React?

A

just write a function that accepts a props parameter and returns a react object - must start with Capital letter

18
Q

How do you mount a component to the DOM?

A

ReactDOM.render()

19
Q

What are props in React?

A

custom inputs you can pass into react functions (properties)

20
Q

How do you pass props to a component?

A

when defining the react element, add an attribute to it - ex:

21
Q

How do you write JavaScript expressions in JSX?

A

inside curly braces

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

something from the dataset that gives it a unique identifier amongst the list item’s siblings

24
Q

How do you create “class” component in React?

A

use: extends React.Component

25
Q

How do you access props in a class component?

A

this.props

26
Q

What is the purpose of state in React?

A

keeps track of changes over the passage of time

the component will re-render when state is changed

27
Q

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

A

define it in when creating the react element as a prop