React Flashcards
What is a Webpack?
Module bundler (that bundles JavaScript files for usage in a browser)
How do you add a devDependenccy to a package?
npm install -D packagename
What is an NPM script?
A way to bundle common shell commands for a project
How do you execute Webpack with npm run?
npm run build
“build” is written in the “scripts” of the package.json file - it can be named something else too
How are ES modules different from CommonJS modules?
o ES modules import everything before the code is executed unlike CommonJS modules which load dependencies on demand while the code is getting executed
o Different syntax (CommonJS uses require and ES uses import)
o ES module syntax is part of the language but CommonJS modules need a loader (it’s not an official standard- instead it’s a community library)
What kind of modules can Webpack support?
o ECMAScript modules
o CommonJS modules
o AMD modules
o Web Assembly
What is React?
A JavaScript library for building UI
Actually a framework
What is a React element?
Plain object that describes what a DOM should look like
How do you mount a React element to the DOM?
ReactDOM.render(element, [container])
What is Babel?
JavaScript compiler used to convert latest ECMAScript code into a backwards compatible version of JS
What is a Webpack loader?
Tool that pre-processes a file before importing with plug-ins
(Tool that helps webpacks interpret and translate files in order to bundle static assets)
How can you make Babel and Webpack work together?
npm install babel-loader as a devDependency
What is a Plug-in?
A software component that adds a specific feature to an existing computer program
What is JSX?
o JavaScript XML
o Syntax extension to JavaScript
Why must the React object be imported when authoring JSX in a module?
Because it’s used in the final code of babel outputs (babel calls React.createElement in its output so ‘createElement’ would not work without the ‘React’ object)