Skip to content

Instantly share code, notes, and snippets.

@frivolta
Created May 27, 2022 15:31
Show Gist options
  • Save frivolta/1a50a8b5dc80d79f899c0d90cc93cf00 to your computer and use it in GitHub Desktop.
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
// 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