React Flashcards
What is React?
a js library for creating user interfaces in a more intuative way.
What is a React element?
it is an object that represents a DOM
How do you mount a React element to the DOM?
You mount it using render, with the element name and then a container
What is Babel?
Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments
What is a Plug-in?
software component that adds a specific feature to an existing computer program
What is a Webpack loader?
Loaders are transformations that are applied to the source code of a module. They allow you to pre-process files as you import or “load” them. Thus, loaders are kind of like “tasks” in other build tools and provide a powerful way to handle front-end build steps. Loaders can transform files from a different language (like TypeScript) to JavaScript or load inline images as data URLs.
How can you make Babel and Webpack work together?
install babel loader
What is JSX?
It is called JSX, and it is a syntax extension to JavaScript. We recommend using it with React to describe what the UI should look like. JSX may remind you of a template language, but it comes with the full power of JavaScript.
Why must the React object be imported when authoring JSX in a module?
Since it uses the react-createElement syntax, it needs to be imported
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
@babel/plugin-transform-react-jsx
What is a React Component?
It is a function that can be used like a reusable code it can also be a class component: it accepts a single”props” object argument with data and returns a React element.
How do you define a function component in React?
This function is a valid React component because it accepts a single “props” (which stands for properties) object argument with data and returns a React element. We call such components “function components” because they are literally JavaScript functions.
How do you mount a component to the DOM?
Render method is how you mount a component
What are props in React?
You can pass any JavaScript expression as a prop, by surrounding it with {}. For example, in this JSX:
(How we pass data into components)
How do you pass props to a component?
function CustomButton(props) { return ( {props.text} ); }