3 ms·
Where do the savings come from? I can't imagine that React.createClass() is all that much code. I'm guessing a lot of space saving comes from not doing PropType
by losvedir 11y ago
Where do the savings come from? I can't imagine that React.createClass() is all that much code. I'm guessing a lot of space saving comes from not doing PropTypes (which I find immensely useful) and not having a synthetic event system (meaning you can't test with TestUtils.Simulate.click()). What else is missing I wonder?
- TheMakeA 11y agoPropType checking is compiled out of the production version of React.
- Ronsenshi 11y agoLack of synthetic events is a huge one for me.
- developit 11y agoThis is extremely interesting to me and I would love to hear why. I skipped synthetic events because I didn't feel they were necessary, but I would appreciate additional insight.
- peterhunt 11y agoAlso property/attribute normalization. Preact: https://github.com/developit/preact/blob/master/src/preact.js#L890 https://github.com/developit/preact/blob/master/src/preact.j... React: https://github.com/facebook/react/blob/3b96650e39ddda5ba49245713ef16dbc52d25e9e/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L40 https://github.com/facebook/react/blob/3b96650e39ddda5ba4924...
- developit 11y agoPropTypes are supported out of the box in preact-compat. You could also use them via a preact vnode hook and the "proptypes" module (npm.im/proptypes), which is just pulled from React's codebase. Synthetic events I'm very much open to feedback on - I tend to fire actual DOM events in my Karma tests, but it seems that less common.