Module-3 Flashcards
What is Array.prototype.filter useful for?
Useful for filtering arrays.
What is Array.prototype.map useful for?
Useful for transforming an array.
What is Array.prototype.reduce useful for?
Useful for returning a single value from an array.
What is “syntactic sugar”?
A version of code that is more readable.
What is the typeof an ES6 class?
A function.
What is “refactoring”?
Restructuring code to be more efficient and readable but not changing the output.
What is a webpack?
Webpack is a tool that bundles JavaScript applications, and supports any module format aside from ESM.
How do you add a devDependency to a package?
From the root directory in the command line, you run npm install with the package-name and the “–save-dev” flag
What is an npm script?
An npm script bundles commands together, and are typically commands, or a string of commands that would usually be entered in the command line to have an application do something.
How do you execute Webpack with npm run?
With npm run script-name.
What is Babel?
Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into compatible versions of JavaScript.
What is a plug-in?
A software component that adds a specific feature to an existing program.
What is a webpack loader?
Loaders are transformations that are applied to source code of a module, and provide a way to handle front-end build steps.
How can you make Babel and webpack work together?
Install the Babel loader then configure the webpack.js file.
What is JSX?
JSX is a React extension to the JavaScript language syntax.
Why must the react object be imported when authoring JSX in a module?
To bring the React library in scope with the JSX code.
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
You can use a Babel loader
What is a React component?
React components are JavaScript functions or classes that are reusable pieces of code.
How do you define a function component in React?
You start with the keyword function, followed by a function name with a (parameter), opening curly brace, then a return react elements. Ending with a curly brace.
How do you mount a component to the DOM?
Create a react root by calling the createRoot method of the ReactDOM object with the react elements and assigning it to a variable. Then the render method of the root object is called with the function as an argument.
What are props in React?
Props are objects.
How do you pass props to a components?
Props are passed to a component thru a DOM tag name and assigning a value to the prop name, then assigning the return value to an element.
How do you write JavaScript expressions in JSX?
JavaScript expressions are wrote in JSX within a functions’ curly braces.
What are controlled components?
An input form element whose value is controlled by React.