React Class Components Flashcards
1
Q
How do you create “class” component in React?
A
By defining a class with a capitalized class name, then typing extends React.Component after.
2
Q
How do you access props in a class component?
A
Using this.props when returning a react element in the code block of the render function. Then when declaring a React element, include the property name of the prop you are trying to access.