Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is render hijacking in react?

Today, I read that Hoc (High Order component) enables render hijacking, So I want to know what render hijacking is if anybody knows this concept please share here.

like image 706
kalyani_jamunkar Avatar asked Jan 08 '18 05:01

kalyani_jamunkar


1 Answers

As Mr. Google says, "The concept of render hijacking is the ability to control what a component will output from another component". It actually means that you decorate your component by wrapping it into a Higher-Order component. By wrapping you can inject additional props or make other changes, which can cause changing logic of rendering. It does not actually "ENABLES" hijacking, but by using HOC you make your component behave in different way.

This article has a very good explanation

This other article elaborates on a possible use-case for applying that pattern

like image 162
user8685433 Avatar answered Oct 19 '22 09:10

user8685433