React Flashcards
How should a component update its props?
Never directly. A change handler function should be passed down through props.
What does the effect hook replace?
Component lifecycle methods
mounting
updating
unmounting
This is a syntax extension for JavaScript to allow HTML in the form of expressions
JSX
HTML or JSX attributes which trigger a function upon a certain action
Event listeners
Examples
onClick
onChange
Does JS logic belong inside or above a component’s return statement?
Above
A component returned inside another component
Instance
What is the meat of an open component instance called and how is it rendered inside?
const ChildComponent = (props) => {
return (
{ props.children }
)
}
How do you assign .defaultProps?
After the function component:
ComponentName.defaultProps = {
property: value
}
This hook replaces the getter and setter methods for state in a functional component
useState()
A function called inside of another function
Callback Function
Higher Order Function
Takes a callback function as argument
eg. arr.map(num => num * 2)
.map is a higher order function