Created
May 27, 2022 15:31
-
-
Save frivolta/1a50a8b5dc80d79f899c0d90cc93cf00 to your computer and use it in GitHub Desktop.
Write better React, compose multiple functional HoCs, Higher-Order Components - Custom Higher Order Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We first define the function we will be using as an argument | |
const addOne = (arg)=>arg+1 | |
// We than define our hof | |
const higherOrderFunction = (fn, arg) => fn(arg)*2 | |
// The result will be 12 | |
higherOrderFunction(addOne, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment