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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly