React Flashcards
What is React?
JS library for building UI
For front-end
What is a React element?
basic building block in a react application - an object representation of a virtual DOM node
It’s just an object
How do you mount a React element to the DOM?
by calling ReactDOM. and calling render()
What is Babel?
Toolchain 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?
it gives extended functionality
What is a Webpack loader?
transformations that are applied to the source code of a module
Webpack loaders follow thru import/export and convert the syntax and style as it goes through it
How can you make Babel and Webpack work together?
install ‘babel-loader’ to the loader
What is JSX?
a syntax extension to JS
allows us to write declarative JS like writing html within js
Why must the React object be imported when authoring JSX in a module?
Because it works with React object to because we are actually using react ReactDom.createElement()
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Babel-loader and the babel plugins
What is a React component?
independent and reusable bits of code
They serve the same purpose as JS functions but work in isolation and return HTML
How do you define a function component in React?
a function that returns an HTML-like syntax
How do you mount a component to the DOM?
root.render()
What are props in React?
type of object where the value of attributes of a tag is stored
props –> properties
How do you pass props to a component?
add them to the JSX