Class-28 Readings: Component Composition


Class-28 Readings: Component Composition

Table of Contents

Reading, Research, and Discussion

1. Can a parent component access the state of a child component?

  • Yes I believe a parent and you some sort of component hook to retrieve the state of a child component.

2. What can be passed along in a prop variable?

  • I believe we can pass anything we might need to the next component. Props is an object.

3. How can a child component “know” the state of another component?

  • This can be passed information to the child component in the form of props.

Vocabulary Terms

  • component props :
    • def: When React sees an element representing a user-defined component, it passes JSX attributes and children to this component as a single object. We call this object “props”.
  • component state :
    • def: State is what is the current representation of a particular component or piece of an application.
  • application state :
    • def: An application state is simply the state at which an application resides with regards to where in a program is being executed and the memory that is stored for the application. The web is “stateless,” meaning everytime you reload a page, no information remains from the previous version of the page.

Additional Resources

Bookmark / Skim