react-class-components Flashcards

1
Q

How do you create a “class” component in React?

A

class keyword, ClassName, extends keyword, React.Component, curly braces, inside curly braces is the root prototype method that returns a react element in it’s codeblock
react components always need to return a react element

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

in a class component, props is a property of this whereas in a function it is an argument

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