Single responsibility principle in terms of components, is about simplifying each component. Each component should only be responsible for one thing, if it does get larger it be broken up into smaller sub-components instead of one large section of code that continues to get bigger and bigger.
When we build a static version of our application, we’re referencing an application that only involves text and is not interactive. essentially want to use props to display the information that we have, we don’t want to have a fluctuating state that is going to update all of that information.
Once we have a fully complete static application we need to start thinking about interactivity,and how we’re gonna use state
to accomplish that.
The three questions we need to ask ourselves to figure out if something need to be state are the following
1. Is it passed in from a parent via props? If so, it probably isn’t state.
2. Does it remain unchanged over time? If so, it probably isn’t state.
3. Can you compute it based on any other state or props in your component? If so, it isn’t state.
one of the most important pieces about state is that it is one way data flow,does must follow and adhere to our component hierarchy.In order to figure out where states should belong we need to identify each component that renders something and the common component above all of them that needs that state to be able to feed it back down as a prop
a higher order function is a function that takes in other functions as arguments or returns them,Higher order functions allow us to iterate over functioning actions not just values.
the second line in the greater than function,is returning another function that determines if M is greater than N, if it is then it will return M.
are map and reduce functions operate by transforming an array by applying a function to each element And then it builds a brand new array from the return to values. the content is going to look different than the original input. in the instance of our reduce function,we would take the initial array and then we would add the next object value to a brand new array and then continues down the line creating that new value for the new array based on the old elements of the old array.