DEV Community

Cover image for 5 Tips Every React Developer Should Know

5 Tips Every React Developer Should Know

Tapajyoti Bose on October 10, 2021

React is an amazing tool to build Front End Applications. This article will provide you some tips which you can immediately implement to up your Re...
Collapse
 
pengeszikra profile image
Peter Vivo

I never try to check facebook with dev tools ... it was so interesting.

Collapse
 
ruppysuppy profile image
Tapajyoti Bose

:)

Collapse
 
willaiem profile image
Damian Żygadło

HOC is deprecated.

Collapse
 
ruppysuppy profile image
Tapajyoti Bose

So what's the replacement for HOC?

Collapse
 
devrithm profile image
Ahmed • Edited

I mean why use HOC and not just simplify it with a general Layout component

So simply speaking:

const Layout = ({children}) => {
   return (
      <Header />
      <main>{children}</main>
      <Footer />
   )
}

export default Layout;
Enter fullscreen mode Exit fullscreen mode

and than you can wrap any page or template you wish with your Layout component!

Thread Thread
 
ruppysuppy profile image
Tapajyoti Bose • Edited

Using the HOC is a more sleek solution. It still has the same issues as the HOC approach

Thread Thread
 
wutangpaul profile image
Paul McClean • Edited

"Sleek" is pretty subjective. I much prefer a layout component rendering child elements. It makes the HTML structure easier to read, in my opinion.

Thread Thread
 
ruppysuppy profile image
Tapajyoti Bose

I do agree, "sleek" indeed is subjective

Collapse
 
vladi160 profile image
vladi160

= <></>

Collapse
 
jprly profile image
jprly

Great code examples, thank you!

Collapse
 
ruppysuppy profile image
Tapajyoti Bose

Glad you found it helpful!