CLASS 28
Component Composition
REVIEW, RESEARCH AND DISCUSS
Can a parent component access the state of a child component?
- To access a child state that is declared as a functional component hooks you can declare a ref in the parent component, then pass it as a ref attribute to the child but you need to use React.
What can be passed along in a prop variable?
- Data can be passed along in a prop variable
How can a child component know the state of another component?
- Another child can know the state of another component using props
TERMS:
component props
- Props are arguments passed into React components. Props are passed to components via HTML attributes.
component state
- The State of a component is an object that holds some information that may change over the lifetime of the component.
application state
-
Application state can also be referred to as that of the finite-state machine — where it is used as part of a model for controlling the flow and execution of changes to an application.