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.
5.How can you identify where state needs to live?
1. ProductTable needs to filter the product list based on state and SearchBar needs to display the search text and checked state.
2. The common owner component is `FilterableProductTable`.
3. It conceptually makes sense for the filter text and checked value to live in `FilterableProductTable`
greaterThan
function as defined in the reading. In your own words, what is line 2 of this function doing?
this function is doing another function with it, its areturn to the value which in this case is nmap
or reduce
operates, with regards to higher-order functions.
Reduce is the higher-order operator that reflects this pattern (sometimes also called fold). It creates a value by mixing a single member from the array with the current value over and over again. When summing numbers, start with zero and add each element to the total.
Aside from the array, the arguments to reduce are a combining function and a start value. This function is a little more complicated than filtering and mapping.