For further actions, you may consider blocking this person and/or reporting abuse
Read next
React 19: New hook useActionState
Jaime -
React + Vite: The ultimate guide to static application deployment
FAB Builder | Code Generation -
SvelteKit VS Astro. laidback side by side
Jackie Yio Hex ð¥ -
Hey Open-Source Community! If you have not read it before, check out this article! :)
Oleg Dubovoi -
Top comments (6)
I think the official React docs explicitly say they encourage devs to start using hooks going forward, but as far as I know there's no plan to deprecate class components and the older way to manage lifecycle events.
I wouldn't be surprised if the React docs start to reflect that more and more eg in code examples, with hooks being the default implementation shown
Yes, I was confused because the React Hooks introduction encourages React hooks, but the documentation mostly includes code with class components. Is this because React hooks are new? But, it was 2018 when hooks were introduced, according to Google.
I've only seen companies start to adopt hooks in the last year really, and a lot haven't adopted them at all yet. I reckon we'll start to see the docs catching up to the new "normal" sometime this year ð®
Not entirely.
Hooks are still so new that best practices haven't entirely been figured out. If you are looking for a certain stability and confidence in your component side effects, I think classes would provide the best way. That being said, at my job we're using hooks in new code, but we're not putting in much effort into refactoring old code quite yet until we develop code quality standards and guidelines for how to really use hooks.
see Concent, A predictableãzero-cost-useãprogressiveãhigh performance's enhanced state management solution,
here is a online demo to show you how Concent unified the life cycle method with setup feature
codesandbox.io/s/nifty-cdn-6g3hh
They have for me. I only use hooks, and haven't needed to write a class component yet.