4 ms·
There are no breaking changes. Class components are still supported and used at Facebook
by Capricorn2481 3y ago
There are no breaking changes. Class components are still supported and used at Facebook
- pier25 3y agoClass components are deprecated. They only appear in the legacy section of the reference. https://react.dev/reference/react/legacy https://react.dev/reference/react/legacy
- rozenmd 3y ago> These APIs are exported from the react package You can still write React the old way.
- trgn 3y agoSure. But search anything about React, and you'll see examples in hooks. I don't even understand the reason why class-based is "legacy". Why are hooks inherently better? Code-reuse is a factoring concern, not a paradigm concern. And component-life-cycle bugs are now replaced with nearly impossible to understand callback stacktraces.
- Capricorn2481 3y agoThat doesn't mean classes are deprecated, it means people prefer hooks, and I understand why, as someone that codes in both. It's like saying "All Javascript things I search are only in ES2020." It doesn't mean javascript is deprecating features.
- andrewmcwatters 3y agoOh also certain concepts and strategies are only written about in the legacy documentation. Good luck new devs!
- zoover2020 3y agoReminds me of a React V11 codebase at work. It is bad enough that I always include it as a heads up during our scoping, as in: "double your estimates because the version of React is so old"
- june_twenty 3y agohappens to lots of stuff and is not react specific
- c-hendricks 3y agoCare to source/link them? You obviously think they're important so you should do some good and share!
- andrewmcwatters 3y agoNew docs don't tell you how to get a minimal start anymore. You MUST fully commit to a create-react-app flow or similar, or they vaguely point you in the direction of Babel without explicit direction. The formal way of using React and JSX without a full SPA framework is only listed here: https://legacy.reactjs.org/docs/add-react-to-a-website.html https://legacy.reactjs.org/docs/add-react-to-a-website.html
- c-hendricks 3y agoAh, I guess you're referring to how they're pushing frameworks over bundlers? > If you want to build a new app or a new website fully with React, we recommend picking one of the React-powered frameworks popular in the community. Frameworks provide features that most apps and sites eventually need, including routing, data fetching, and generating HTML. > Grab react and react-dom from npm, set up your custom build process with a bundler like Vite or Parcel, and add other tools as you need them for routing, static generation or server-side rendering, and more. https://react.dev/learn/start-a-new-react-project#can-i-use-react-without-a-framework https://react.dev/learn/start-a-new-react-project#can-i-use-...
- 3y ago
- williamstein 3y agoMinor correction -- It seems like the page you link to has two sections: Legacy APIs and Deprecated APIs. Class components are not deprecated; instead, they are in the legacy section. The only thing that is listed as deprecated in the page you link to is "createFactory -- lets you create a function that produces React elements of a certain type."