4 ms·
I'm really curious, what did they have to throw overboard to lighten the load from 45kB to 3kB? They list a handful of missing bits[1] -- I'm not a React devel
by outsidetheparty 9y ago
I'm really curious, what did they have to throw overboard to lighten the load from 45kB to 3kB? They list a handful of missing bits[1] -- I'm not a React developer so I don't know how significant they are, but they don't sound like the sort of things that'd multiply the size of the codebase by fifteen... So what's the deal? How so small?
[1] (https://github.com/developit/preact/wiki/Differences-to-React https://github.com/developit/preact/wiki/Differences-to-Reac...)
- krirken 9y agoSome key points: 1. Preact eliminated white/black lists and uses regexes instead [1]. These lists take up huge amounts of space in React/ReactDOM [2]. 2. No synthetic events, just native `addEventListener` [3]. 3. Only target the DOM for rendering, no React Native to worry about. 4. Less invariants, error handling, and error messages [1] https://github.com/developit/preact/blob/master/src/constants.js#L11-L12 https://github.com/developit/preact/blob/master/src/constant... [2] https://github.com/facebook/react/blob/master/src/renderers/dom/shared/SVGDOMPropertyConfig.js#L32-L121 https://github.com/facebook/react/blob/master/src/renderers/... [3] https://github.com/developit/preact/blob/master/src/dom/index.js#L69 https://github.com/developit/preact/blob/master/src/dom/inde...