1 min read

React Higher-Order-Components

A higher-order component (HOC) is an advanced technique in React for reusing component logic. HOCs are not part of the React API, per se. They are a pattern that emerges from React’s compositional nature.
React Higher-Order-Components

Higher order components are JavaScript functions used for adding additional functionalities to the existing component. These functions are pure, which means they are receiving data and returning values according to that data.

HOC is wrapping around the normal component and provides additional data input. It is actually a function that takes one component and returns another component that wraps the original one.

Let us Understand the working of HOC's from the below example:

//Function Creation function add (a, b) { return a + b } function higherOrder(a, addReference) { return addReference(a, 20) } //Function call higherOrder(30, add) // 50

Here, the function you are passing is called a callback function, and the function where you are passing the callback function is called a higher-order(HOCs) function.

ReactJS - Higher Order Components - Tutorialspoint
ReactJS - Higher Order Components - Higher order components are JavaScript functions used for adding additional functionalities to the existing component. These functions are pure, which means the
https://www.tutorialspoint.com/reactjs/reactjs_higher_order_components.htm

#Reactjs #HOC #Components #Advanced #Technique #Probyto #ProbytoAI

Subscribe and follow us for latest news in Data Science and Machine learning and stay updated!
Facebook: https://facebook.com/probyto
Twitter: https://twitter.com/probyto
LinkedIn: https://linkedin.com/company/probyto
Instagram: https://instagram.com/probyto