Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Recently I was looking at my 200Kb app minfied for what was the largest portion of it, and, Lo and behold, react-dom comprised a little under half that size.

Part of this is because React and ReactDOM haven’t switched over to ESM (and still use CJS), but calling react small is probably not entirely honest, at least if you use it like most folks do.



Dan Abramov has said several times that switching React's codebase to ESM won't result in any magic size drops from tree shaking, as there's really not any "unused" portions of the React codebase.

My understanding is that React's synthetic event system is a large portion of its size. Dan suggested that React 16's support for custom renderers would allow creating a "lite" equivalent to ReactDOM [0] if people wanted to, and at least one person has done so [1].

[0] https://twitter.com/dan_abramov/status/938937405524017152

[1] https://github.com/jquense/react-dom-lite/


They meant its API surface, not filesize. React is ridiculously small and simple for what it can do.


yes, this is exactly what I meant. Thank you!


Gzipped and minified, React with React DOM is 32k bytes. Which is fine for most apps.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: