Mordern Web Flashcards

1
Q

What is Webpack?

A

webpack is an open-source JavaScript module bundler. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included.

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

npm instal –save-dev webpack

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

What is an NPM script?

A

it’s a script to install dependency

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 build

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

What is React?

A

React is a JavaScript library for creating user interfaces.

React is a free and open-source front-end JavaScript library for building user interfaces or UI components.

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

What is a React element?

A

its an object
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
7
Q

How do you mount a React element to the DOM?

A

ReactDOM.render(reactElement, domContainerNode)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
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
9
Q

What is a Plug-in?

A

plug-in (or plugin, add-in, addin, add-on, or addon) is a software component that adds a specific feature to an existing computer program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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. Loaders can transform files from a different language (like TypeScript) to JavaScript or load inline images as data URLs. Loaders even allow you to do things like import CSS files directly from your JavaScript modules!

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

How can you make Babel and Webpack work together?

A

babel-loader

npm install -D babel-loader @babel/core @babel/preset-env webpack

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

What is JSX?

A

it is a syntax extension to JavaScript

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

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

A

import react to compile the component

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

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

A

webpack and babel-loader

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

What is a React component?

A

components are like JavaScript 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
16
Q

How do you define a function component in React?

A
function FunctionName(){
return reactElement
}
(Note name first letter should be capital)
17
Q

How do you mount a component to the DOM?

A

ReactDom.render and pass reactComponent Name

18
Q

What are props in React?

A

props is an object

19
Q

How do you pass props to a component?

A

eg constructname attribute=string or constructname attribute={expression}

20
Q

How do you write JavaScript expressions in JSX?

A

{}

21
Q

How do you create “class” component in React?

A

classkeyword component extend React

22
Q

How do you access props in a class component?

A

this.props.name

23
Q

What is the purpose of state in React?

A

provide infomation of current state

24
Q

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

A

*

25
Q

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

A

The best way to pick a key is to use a string that uniquely identifies a list item among its siblings. Most often you would use IDs from your data as keys: