3 ms·
Class components and HOCs aren’t deprecated though.
by crab_galaxy 2y ago
Class components and HOCs aren’t deprecated though.
- only-one1701 2y agoThey're very much not "best practices", and will be deprecated soon (if they're not already).
- hajile 2y agoYou 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.
- zero_shift 2y agoI'm not aware of any indication that class components will be deprecated.
- deleted 2y ago[deleted]
- madeofpalk 2y agoBut 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.
- only-one1701 2y agoMea 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.
- jdauriemma 2y agoThat's not true (the deprecation part, anyway) and I know of at least one React team member who has spoken publicly to that fact.
- rcarr 2y agoI 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. https://react.dev/reference/react/Component https://react.dev/reference/react/Component