My reading journal for Code Fellows.
A component should do only one thing. If it grows too large, you should deconstruct it into smaller components to maintain this principle.
A static application takes your data and renders the UI, but does not have any interactivity.
After you have completed your static application, you can add in the interactive functionality.
Is it passed from a parent using props? If yes, then it should not be state.
Does it remain unchanged over time? If yes, it is probably not state.
Can you compute it based on any other state or props in your component? If yes, then its not state.
Identify all components that render something using that state and then find a common owner component above all those components. This should be where you want to store that state data.
A higher-order function operates on other functions, by either returning them or taking them as arguments.
Line 2 returns a boolean value based on whether or not m is greater than n.
Map and reduce both operate as higher functions because of the operations they perform. Although they look simple on the surface, the examples from the reading break it down so you can see the inner workings. They both operate on an array of data which they take as an argument and then return a transformed version of that data after performing another function on it. The function that is performed to transform the data is also passed into map or reduce as another argument along with the data. This reading revealed some of the simple functions we’ve been using to actually not be so simple.
I would like to get more practice using higher order functions. It looks like you have the ability to perform more complex logical operations by passing and returning functions. I would like to understand this concept better not only to be able to use it, but for the fun of being able to think through the logic of all operations being performed.