React Quiz Questions Flashcards
What is React?
A JavaScript library for building user interfaces
What is a React element?
React elements are plain objects, and are cheap to create
How do you mount a React element to the DOM?
The render method of the ReactDom object
What is JSX?
A syntax extension to JavaScript
Why must the React object be imported when authoring JSX in a module?
So we can compile react and babel
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
You need the babel plugin-transform-react-jsx
What is a React component?
UI split into independent, reusable pieces
How do you define a function component in React?
Write a JavaScript function with an uppercase character to start
How do you mount a component to the DOM?
ReactDom render with the component passed as the tagName argument
What are props in React?
It is an object
How do you pass props to a component?
Putting a key value pair inside the component
How do you write JavaScript expressions in JSX?
By writing the expression within a set of curly braces
What Array method is commonly used to create a list of React elements?
The map method
What is the best value to use as a “key” prop when rendering lists?
A unique id within the dataset that was passed in
How do you create “class” component in React?
Extend the React.Component and declare a render method in the class