React
Introduction to React Hooks - Concepts Review

More Functional Ideas

PRO
Outline

So how does this all change our way of thinking?

Hooks allow us to step away from an object-oriented standpoint that utilizes class inheritance and jump into functional programming with functional components where we can compose smaller testable code into predictable outcomes .

Pure functions that take a single input and return a single output are one example of predictable and efficient code. It can be difficult to think functionally. Here are some tips to help yourself to think more functionally:

✅ Look at imperitive code and look at it to be functional

✅ When writing a function, ask yourself if there are parts of your code that can be reused to make the function you need through composition. Can it be a pure function?

Take a look at the links below to dive deeper into functional programming.

Another way to understand the inner workings of hooks is by cloning them, or to code them yourself. This will also help you increase your understanding of JavaScript.

MDN Docs Closures

Understanding Closures in Javascript

Deep dive: How do React hooks really work?

 

I finished! On to the next chapter