React Flashcards
What is Webpack?
A bundler for your JavaScript files, their dependencies and other assets of your application (ex CSS, images, html)
How do you add a devDependency to a package?
npm install –save-dev
What is an NPM script?
CLI commands you can add to the scripts section/property of package.json. You can give the commands a name and run them using
npm run
How do you execute Webpack with npm run?
Depends on what name you give the npm script
Usually it’s npm run build
How are ES Modules different from CommonJS modules?
ES modules are used on the front-end when working with javascript running on the browser;
Common js modules and require statements and module.exports are used with Node on the backend
What kind of modules can Webpack support?
Most of them??
Webpack supports the following module types natively:
ECMAScript modules CommonJS modules AMD modules Assets WebAssembly modules
What is React?
Javascript library for creating user interfaces;
What is a React element?
jsx that describes a piece of UI
How do you mount a React element to the DOM?
ReactDOM.render() method
What is a React component?
A JavaScript function or class that accepts inputs called props and returns a react element
How do you define a function component in React?
function ComponentName(props) { return < html >Hello, {props.name}< html >; }
What are props in React?
Arguments/inputs to a react component, they are accessed as properties on an object called props
How do you pass props to a component?
Through the component’s attributes
How do you write JavaScript expressions in JSX?
Enclosed in {}
How do you create “class” component in React?
extend the React.Component base class; give it a render function that returns jsx