301 Class Five Reading Notes “Putting it all together: Thinking In React”
5 Steps
- Break The UI Into A Component Hierarchy
- Build A Static Version in React
- Identify The Minimal (but complete) Representation Of UI State
- Identify Where Your State Should Live
- Add Inverse Data Flow
Questions
- What is the single responsibility principle and how does it apply to components? The idea components ideally should only do one thing.
- What does it mean to build a ‘static’ version of your application? A version that just renders your data before the functionality comes.
- Once you have a static application, what do you need to add? You need to identify the minimum viable product(in working state).
- What are the three questions you can ask to determine if something is state? Is it passed in from a parent via props? Does it remain unchanged over time? Can you compute it based on any other state or props in your component?
- How can you identify where state needs to live? Identify every component that renders something based on that state, or find all cpmponents where something lives only in the component.
- What is a “higher-order function”? Functions that operate on other functions, either by taking them as arguments or by returning them.
- Explore the greaterThan function as defined in the reading. In your own words, what is line 2(
return m => m > n;
) of this function doing? It is searching over the array and will return number m if it is greater tha n.
- Explain how either map or reduce operates, with regards to higher-order functions. The map method transforms an array by applying a function to all of its elements and building a new array from the returned values.
Resources
Return to the Table of Contents
Table of Contents