# React and Forms

[Return to Home](https://sethppierce.github.io/reading-notes)

## Questions

### React Docs - Thinking in React

What is the single responsibility principle and how does it apply to components?- a component should ideally only do one thing.

What does it mean to build a ‘static’ version of your application?- it takes our data model and renders the ui, but has no interactivity

Once you have a static application, what do you need to add?- add state

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?- the highest point of where that data will be needed.

### Higher-Order Functions

What is a “higher-order function”?- They allow us to abstract over actions, not just values.

Explore the greaterThan function as defined in the reading. In your own words, what is line 2 of this function doing?- it returns true or false if the argument passed in is greater than the m, where m is the last number passed in on line 4, and stored on in the variable greaterThan10

Explain how either map or reduce operates, with regards to higher-order functions. They build a new array, and do not modify the original array, with items that pass the filter test or by mapping through and modifying and make a new array.
