Reading-notes

Thinking in React

HOw would you break a mock into a component heirarchy?

1- Break The UI Into A Component Hierarchy

2- Build A Static Version in React

3-Identify Representation Of UI State

4-Identify Where Your State Should Live

5-Add Inverse Data Flow

What is the single responsibility principle and how does it apply to components?

a component should ideally only do one thing. If it ends up growing, it should be decomposed into smaller subcomponents.

## What does it mean to build a ‘static’ version of your application?

has no interactivity( building a static version requires a lot of typing and no thinking, and adding interactivity requires a lot of thinking and not a lot of typing.)

once you have a static application, what do you need to add?

Add the Data Flow ( support data flowing the other way)

## What are the three questions you can ask to determine if something is state?

Is it passed in from a parent via props? If so, it probably isn’t state.

Does it remain unchanged over time?

If so, it probably isn’t state.

Can you compute it based on any other state or props in your component? If so, it isn’t state.

How can you identify where state needs to live?

1- Identify every component that renders something based on that state. 2- Find a common owner component

Things I want to know more about:

Functional components React Hooks