react Flashcards
What is JSX?
JSX is a syntax extension to JS
Why must the React object be imported when authoring JSX in a module?
bc it gets transformed into react.create element
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
we need babel-loader and the babel plugin transform react jsx
What is a React component?
its a reusable piece of code
How do you define a function component in React?
function keyword followed by the function name and return the JSX
How do you mount a component to the DOM?
using the reactDOM.render
What are props in React?
properties of the component
How do you pass props to a component?
key value pair on jsx component that resembles an attribute
How do you write JavaScript expressions in JSX?
wrap them with curly brace
What is the purpose of state in React?
to let us manage changing data in an application
How to you pass an event handler to a React element?
by using the on click attribute and set it to the method we want to handle
When does React call a component’s componentDidMount method?
when its first mounted
Name three React.Component lifecycle methods.
componentDidMount, componentDidUpdate, componentDidUnmount