Comments (6)
Hi i have a question.
When you compare between wrapper component and HOC shouldn't the HOC's code shows it returns <Component>
instead of <Div>
??
Other than that great write up. Really helps me to understand and differentiate between HOC, wrapper component and the usual component.
from aleksandrhovhannisyan.com.
@tomvuNexus Oops, you're right :) Thanks for pointing that out! Fixed.
from aleksandrhovhannisyan.com.
Don't really see the point of using HOC anymore though. I feel hooks are so much easier to both read, write, and use. 🤔
from aleksandrhovhannisyan.com.
@Svish Hooks are definitely much easier to work with, but you are still going to encounter HOCs in any code base that has class-based components. You can't use hooks in classes.
from aleksandrhovhannisyan.com.
That's true. But I would still kind of recommend to never write another HOC again, unless it's absolutely necessary...
from aleksandrhovhannisyan.com.
That's fine. This article is intended for people who are interested in understanding HOCs. While it's an older pattern, it's still relevant, and understanding why HOCs were used (or even writing one in modern React) can't possibly hurt anyone. New patterns—including hooks—emerge from old ones.
@Svish Edit: I had some time, so I updated the post to mention hooks. Thanks again for the feedback!
from aleksandrhovhannisyan.com.
Related Issues (20)
- Writing Better CSS HOT 7
- Creating a Fluid Type Scale with CSS Clamp HOT 17
- HTML Input Validation Without a Form HOT 1
- copyCode.js error in line: const code = codeBlocks[index].innerText; HOT 1
- Comments are getting truncated after 30 HOT 2
- Design Mode in 11ty HOT 2
- Image attribution not displaying HOT 1
- Feature Request: Front Matter Format For Local Image HOT 1
- Creating an Accessible Image Carousel HOT 10
- Feature Request: Order comments from older to newer HOT 1
- Lamp icon use? HOT 2
- figure.html params
- postImage.html params
- postImage.html params HOT 2
- RSS feed issue HOT 6
- After endless search I found this article. A lifesaver! Thanks
- Sprite Blinking Not Working HOT 2
- Works but how do I tweak it for 2D Platforming?
- are there any advantages to using cqi instead of vw HOT 1
- The Perfect Theme Switch Component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aleksandrhovhannisyan.com.