Tag: HOC

React – what is HOC?

So today I will try to explain what is HOC ( Higher Order Component ) and why we use this type of components in React Apps. Explanation of HOC from React docs is:  “A higher-order component is a function that takes a component and returns a new component”. Manny beginners in React are not aware that with HOC can create better apps without repeating code. Let’s see that in example. Let say that we need authorization in our app and we need to be sure that component is not shown if user is not logged in without HOC we can write something like this:

Continue reading

Copyright by Kristijan Klepač 2018