Component Specification Flashcards

1
Q

render()

A

Render the component to element

returns: ReactElement or false

Note: Should be pure. This means idempotent and it doesn’t interact with the browser (e.g. setTimeout)

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

getInitialState()

A

Get initial value of this.state

returns: object

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

getDefaultProps()

A

If a prop isn’t on this.props, then add in the default

returns: object

This is called before any instances are created, so you can’t depend on this.props in it

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