- Your First Component
Function Component vs Class Component
function: (presentational concept) simplest form. receives object of properties (props)
class: also has a function that has a private internal state. when state changes React will auto re-render that component.
Class components extend the React.Component class.
state vs. props:
state can be changed. props are fixed
- Reusable Components
The STATE of a component can only be accessed by that component itself and no one else!
Sibling elements must be wrapped in 1 element because React cant return multiple adjacent elements
** important React methods to remember **
- setState
when planning/creating a React app:
- decide how many components to use, and what each comp should describe
- can plan Top-Down or down-up
- Function Comp have some advantages over Class Comp
- Only use Class Comp when you need to manage a state object