React/Webpack Flashcards
What is React?
A javascript library for building interfaces
What is a React element?
An HTML element created using React syntax, and the smallest building block of a React app
How do you mount a React element to the DOM?
ReactDOM.render() method
What is Babel?
A JS compiler that comverts ES code into a backwards compatible version of JS
What is a Webpack loader?
They preprocess files as they are imported, allowing for frontend build steps to be handled
How can you make Babel and Webpack work together?
by installing the babel loader as a dev dependency when using Webpack
What is JSX?
A syntax extension that allows you to create React elements using HTML-like markup
Why must the React object be imported when authoring JSX in a module?
JSX creates React elements, which require React in order to be built
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
You install the transform-react-jsx npm plugin as a dev dependency along with the babel loader and webpack
What is a React component?
A function that accepts inputs called props and returns a React element
How do you define a function component in React?
using normal function definitions or es6 classes
How do you mount a component to the DOM?
use ReactDOM.render(), with function name and root css selector as parameters
What are props in React?
Properties that can be passed into a component
How do you pass props to a component?
Enclose the prop value in curly brackets and assign it to a property on the prop object of the component
How do you write JavaScript expressions in JSX?
Enclose the expression in curly braces