react Flashcards
What is React?
React is a free and open-source front-end JavaScript library for building user interfaces or UI components.
What is a React element?
Elements are the smallest building blocks of React apps. An element specifies what should be there in our UI. An Element is a plain object describing what we want to appear in terms of the DOM nodes.
How do you mount a React element to the DOM?
by using ReactDOM.render(element, container)
What is Babel?
Babel is a toolchain that translates ES6 code into ES5.
What is a Plug-in?
Plug-in is a 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.
How can you make Babel and Webpack work together?
By using Babel Loader. (web pack bundles files together and babel is a tool that makes code able to be parsed by most browsers.) Webpack loader will run code through babel before files are bundled into one.
What is JSX?
JSX is an extension to the JavaScript language syntax which provides a way to structure component rendering using syntax familiar to many developers.
Why must the React object be imported when authoring JSX in a module?
Since JSX compiles into calls to React.createElement, the React library must also always be in scope from your JSX code.
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
By using plugin’@babel/plugin-transform-react-jsx’ on webpack.config.js.
first determines the file hierarchy for the project and generates a dependency graph. From the dependency graph it compiles the code to a single source, using Babel to translate and remove the import and export statements, and convert JSX into standard JavaScript.
What is a React component?
Components let you split the UI into independent, reusable pieces. Conceptually, components are like JavaScript 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?
write JavaScript function and pass in single argument “props” (which is an object) and return react element. function components must start with capital letter.
What are props in React?
Props are arguments passed into React components.
Props are passed to components via HTML attributes.
How do you pass props to a component?
Props are also how you pass data from one component to another, as parameters.
How do you pass props to a component?
We pass them as attributes to components.