React Flashcards
What is React?
React is a JS library for building user interface. It lets you compose complex UIs from small and isolated pieces of code called “components”.
What is a React element?
React elements are plain objects, and are cheap to create. (An element describes what you want to see on the screen). React elements are IMMUTABLE: once you create an element, you cannot change its children or attributes.
How do you mount a React element to the DOM?
Use React.render() and pass the React element and a root DOM node to the render function
What is Babel?
Babel is a toolchain that is mainly used to convert ECMAScript 2015 + code into a backwards compatible version of JS in current and older browsers or environments.
What is a Plug-in?
A plug-in is a software component that adds a specific feature to an existing computer program. When a program supports plug-ins, it enables customization.
What is a Webpack loader?
Loaders are transformations that are applied to the source code of a module. They allow you to preprocess files as you import or “load” them.
How can you make Babel and Webpack work together?
install loaders that you want to use (e.g. babel-loader) and specify the loaders inside webpack.config.js file
What is a React component?
Conceptually, components are like JS functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.
How do you define a function component in React?
Regular ES5 function or ES6 class to define a component.
How do you mount a component to the DOM?
ReactDOM.render()
What are props in React?
They are arbitrary inputs passed in to components.
How do you pass props to a component?
Pass it as JSX attributes and children.
How do you write JavaScript expressions in JSX?
You surround it with {}. Then you can pass any JS expression as a prop.