CLASS 29
Routing
REVIEW, RESEARCH AND DISCUSS
Do child components have direct access to props/state from the parent?
- Child componenets have direct access to a parent state/props using
this.state
When a component “wraps” another component, how does the child component’s output get rendered?
- The child component out put gets rendered whenever there is a state change.
Can a component, such as <Content />
, which is a child also be used as a standalone component elsewhere in the application?
- No can’t be used
What trick can a parent use to share all props with it’s children
- A parent uses a spread operator to share all props with it’s children
TERMS:
-
props.children
-
In React it refers to the generic box whose contents are unknown until they’re passed from the parent component.
-
composition
-
Composition is the act of combining parts or elements to form a whole. Components are the UI building blocks in React applications, like pure functions are the building blocks of function composition.