Hacker News new | ask | show | jobs
by amk_ 3360 days ago
The breakup of the React package into a bunch of smaller modules really puts packages that treat React as a peer dependency in a pickle. I have a component module using createClass that works fine and exports a transpiled bundle in package.json. I guess now we'll have to switch to create-react-class, or maintain some kind of "backports" release series for people that are still using older React versions but want bugfixes.

Anyone have experience with this sort of thing?

1 comments

Switching to create-react-class sounds reasonable, that's what we intended. It will work in older versions too.
If we switch to it as a hard dependency, library consumers on React <16 will have an extra package in the bundle. If we make it an optional peer dependency, package.json becomes less reliable because we would need to check where createClass is implemented at runtime.

Is create-react-class smart enough to determine whether the version of React it is augmenting already implements createClass to prevent bundle size bloat?