React Flashcards
What is React?
A JS library used for building user interface
What is a React element?
A plain object describing a component instance or DOM node and its desired properties
How do you mount a React element to the DOM?
you have to create a root of the container and then render the react element
What is JSX?
A syntax extension to javascript that describes what UI should look like
Why must the React object be imported when authoring JSX in a module?
React has to be in the scope in order to create the elements
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Using a webpack config
What is a React component?
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?
Just like a JavaScript function
How do you mount a component to the DOM?
First you must query the dom and then create a root and then render the root
What are props in React?
a type of object where the value of attributes of a tag is stored
How do you pass props to a component?
inside a string literal the object props. a property
How do you write JavaScript expressions in JSX?
place the expression in curly braces
How do you create “class” component in React?
class keyword followed by name extends class object
How do you access props in a class component?
the this keyword
What is the purpose of state in React?
It allows us to manage and change data