React Flashcards
What is React?
a JavaScript framework for building user interfaces
What is a React element?
a plain JavaScript object that is the smallest building block of a React app
How do you mount a React element to the DOM?
ReactDOM.render(element, container, [callback])
What is Babel?
a JavaScript compiler mainly used to convert ES6 code into a backward-compatible version of JavaScript
What is a Plug-in?
a software component that adds a specific feature to and enables customization for an existing computer program
What is a Webpack loader?
a transformations (plug-in) that is applied to the source code of a module
How can you make Babel and Webpack work together?
install babel-loader as a devDependency
What is JSX?
a syntax extension to JavaScript that produces React “elements”
Why must the React object be imported when authoring JSX in a module?
the createElement( ) method of the React object is called to produce React “elements”
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
install @babel/plugin-transform-react-jsx as a devDependency and add the plug-in to webpack.config.js
What is a React component?
a JavaScript function that returns a React element
How do you define a function component in React?
function keyword, capital functionName with props in parentheses, then the code block that returns a React element
How do you mount a component to the DOM?
ReactDOM.render(ReactElement, container)
What’s the difference between a library and a framework?
inversion of control - a framework is a type of library that calls your code
What are props in React?
properties contained in an object that are used to pass data into a React component