ReadingNotes

Putting it all together

Thinking in React

Higher-Order Functions

Question for thinking in react

  1. The single responsibility principle (SRP) is a software design principle that states that a component or module should have only one reason to change. In other words, a component should have only one responsibility or job to do, and any changes to that responsibility should only affect that component. When it comes to components, the SRP means that each component should have a clear and specific responsibility, and it should not be responsible for multiple tasks or concerns. This makes components more modular, easier to understand, and easier to maintain.
  2. Building a ‘static’ version of your application means creating a version of your application that doesn’t require any server-side processing or dynamic data.
  3. Once you have a static application, you need to add server-side processing and dynamic data in order to create a fully functional web application
  4. To determine if something is state, you can ask three questions:
  1. A good rule of thumb is to try to keep state as close to the components that use it as possible. In other words, if a component needs to manage some state, that state should be stored in the component or in a parent component that manages the state for multiple child components. This helps to keep the application organized and makes it easier to reason about how data is flowing through the system.

Ques for higher order function

  1. A higher-order function is a function that takes one or more functions as arguments or returns a function as its result. In other words, it is a function that operates on functions. Higher-order functions are a powerful concept in functional programming because they allow us to write more reusable and composable code.
  2. The greaterThan function is an example of a higher-order function. It takes a number as an argument and returns a new function that takes another number and returns true if that number is greater than the original number, and false otherwise. Line 2 of the greaterThan function is defining a new function using a shorthand syntax called arrow functions.
  3. Map takes a function as its argument and applies that function to each element in an array, creating a new array with the results. Reduce takes a function as its argument and uses that function to accumulate a single value by iteratively combining each element of an array.

Things i want to know more about

I want to learn more about higher order functions and getting more understanding using filter.