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)
2
Q
getInitialState()
A
Get initial value of this.state
returns: object
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