reading notes for code fellows
When you are creating a searchable data table using React, the first step is to create a mock and break the UI into a component hierarchy. To decide which things require their own component, you should use the single responsibility principle, which state that each component should only be doing one thing. After you know which things are components, you can make them into a tree showing parents and children/sibling relationships, which will work as your hierarchy.
The next step is to build a static version in React. You create the structure of the table without adding any interactivity to it to make sure everything looks right and to get the part with the most typing out of the way before you move on to adding interactivity, which requires more thought. When building a static version, you should only be using props and not state.
The third step is identifying the minimal complete representation of the UI. To do this, you need to figure out exactly what your UI needs to accomplish, then figure out what you can do to make that happen in the least code possible and without repeating yourself. Go through each component and figure out what needs to be determined by state and what can remain as props.
Step four is to identify where your state should live. For each piece of state in the application, you should figure out which component it needs to be inside and which components need to be able to edit it. The state should be owned by either a common ancestor of any components that need to be able to manipulate it, or anywhere in the hierarchy above that common ancestor.
Finally you need to add inverse data flow. To do this, you pass callbacks through from the component with the state that needs updating to the component updating the state so you can change the state higher up in the hierarchy.
Higher-order functions are functions that operate on other functions, either by taking them as arguments or returning them. These allow us to abstract over actions rather than values and they come in several forms. They can create new functions, change other functions, or provide new types of control flow.
I did not understand the higher-order functions as extensively as I would have liked.