React Flashcards
What is React?
A JavaScript library for building user interfaces
What is a React element?
An object that describes how the DOM should look
What is Babel?
Babel is a JavaScript compiler mainly used to convert ES2015+ code into backward compatible versions for older browsers.
What is a Plug-in?
A software component that adds a specific feature to an existing program
What is a Webpack loader?
Transformations applied to modules. Allows you to preprocess files and perform other tasks during load.
How can you make Babel and Webpack work together?
Install them as dependencies and add webpack.config.js that calls the babel plugins.
What is JSX?
JavaScript Extension. JSX provides syntactic sugar for the React.createElement function, so you can call it with fewer lines of code.
Why must the React object be imported when authoring JSX in a module?
React.createElement function is needed to render elements in JSX.
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Install webpack, webpack-cli, babel loader, babel/core, babel/plugin-transform-react-jsx. Babel/plugin-transform-react-jsx then gets added to webpack.config.js and transforms JSX to valid JavaScript upon build.
What is a React component?
A function that return React elements
How do you define a function component in React?
Create a function with a return statement that has JSX in it.
How do you mount a component to the DOM?
Call ReactDOM render function and pass in the component and DOM node.
What are props in React?
Props are properties or children passed to a React component
How do you pass props to a component?
In the custom React tag add the name of the props = value
How do you write JavaScript expressions in JSX?
Place it in curly braces within the tags.