React Flashcards
What is React?
A component-based JavaScript library that helps with building user interfaces dynamically.
Combines design and logic layers into one process
What is a React element?
a plain object that describes and HTML element (also a DOM node) is used in the React DOM to update the DOM
How do you mount a React element to the DOM?
calling the render method of the root object, and passing in the result of the createElement method of the React object
What is JSX?
A syntax extension to JavaScript that produces React elements with HTML-like syntax
Why must the React object be imported when authoring JSX in a module?
JSX is part of the React library
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Using the babel loader with the plugin-transform-react-jsx
What is a React component?
Pieces of the UI that accept arbitrary inputs (called “props”) and return JSX, and are reusable in nature
How do you define a function component in React?
A JavaScript function, name starting with a capital letter, that accepts a single property object as an argument and returns JSX
How do you mount a component to the DOM?
the render method of the root object with an argument of the return value of the function component
What are props in React?
Any JSX value or object that is passed into a component as an argument
How do you pass props to a component?
As an argument
How do you write JavaScript expressions in JSX?
By placing the expression inside of curly braces
How do you create “class” component in React?
class ClassName extends React.Component {
render() {
return ;
}
}
How do you access props in a class component?
this.props.propName;
What is the purpose of state in React?
To designate the conditions for how a component will render. If the state changes, the conditions change