React.js Flashcards
What is React?
A JavaScript library for building user interfaces
What is a React Element?
An object that describes an element
How do you mount a react element to the DOM?
ReactDOM.render() method
What is React’s lifecycle?
it’s what happens to a component over the course of it’s lifetime
Mount:
what happens when the component is first introduced to the page
Updating:
what happens when the component is interacted with or changed by the user
Unmounting:
what happens when the component finishes
What two props must you pass to an input for it to be “controlled”?
Value, onChange
What are controlled components?
input elements that are controlled by React,
controlled by Value and onChange
What Array method is commonly used to create a list of React elements?
array.prototype.map()
What is the best value to use as a “key” prop when rendering lists?
ideally, a property key that makes the object unique from it’s siblings
ie:
index, number
When does React call a component’s componentDidMount method?
after the first successful render
Name three React.Component lifecycle methods.
componentDidMount(), componentDidUpdate(), componentWillMount()
How do you pass data to a child component?
through props