Notes
What is the single responsibility principle and how does it apply to components?
- It means that each component does exactly one thing
What does it mean to build a ‘static’ version of your application?
- Building a version of your app that only uses props to pass information and doesn’t apply a state to any of the components
Once you have a static application, what do you need to add?
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?
- By following the data flow down from the parent element
What is a “higher-order function”?
- It is a function that contains less actual code but produces the same result as multiple functions merged together
Explore the greaterThan function as defined in the reading. In your own words, what is line 2 of this function doing?
- it is returning data showing that M is greater than N
Explain how either map or reduce operates, with regards to higher-order functions.
- Map takes an array then recompiles it with a list of a new array that only contains the requested data. Reduce will take all of the items inside an array and reduce them down to a single item which is functionally changed with basic math like addition or subtraction
BACK TO HOME