Re:The Frontend Treadmill
by only-one1701 on Thursday March 20, 2025 @09:16AM
(#43422831)
They're very much not "best practices", and will be deprecated soon (if they're not already).
[ Parent
| on HN ]
Re:The Frontend Treadmill
by madeofpalk on Thursday March 20, 2025 @11:46AM
(#43424871)
But they're not deprecated. Where's the forced churn?
Every place that I've been at has made the gradual shift to migrate stuff away from class components as new stuff gets built or refactored. Seems like a pretty common development habit.
Re:The Frontend Treadmill
by jbreckmckye on Thursday March 20, 2025 @11:28AM
(#43424660)
I'm not aware of any indication that class components will be deprecated.
You still can't add features like error boundaries in React without class-based components somewhere in your app. Even if they added these features to functional components today, it would be years before they'd consider them safe to remove.
HOC still exist and builtin features like `React.memo(MyComponent)` along with the like of more functional styles means they aren't ever going away.
Re:The Frontend Treadmill
by only-one1701 on Thursday March 20, 2025 @03:14PM
(#43427653)
Mea culpa: they’re not being deprecated. But the existence of custom hooks removes the bulk of (if not all of) their utility, and make it much easier to reason about code and make your code well-typed.
Re:The Frontend Treadmill
by jdauriemma on Thursday March 20, 2025 @03:35PM
(#43427880)
That's not true (the deprecation part, anyway) and I know of at least one React team member who has spoken publicly to that fact.
I have no idea why you are getting downvoted for this comment when there is literally a massive warning on the docs page for class components.