threepointone / rakt

fast websites, by default
291 stars 12 forks source link

preact #2

Open threepointone opened 7 years ago

threepointone commented 7 years ago

while it would be simple enough to use preact-compat and call it a day, I'd like to explore whether we can make a boutique preact build, and how much code the 2 variants could share.

Further, we're not really tied to react-router, any component that accepts a render function would do. So there's an opportunity to shave away bytes with a bespoke lib.

This is the react-specific file. I don't foresee too many issues, just have to work on it once rakt gets to somewhere stable.

//cc @developit

developit commented 7 years ago

Can't see much in there that would cause issues. Would it be workable to just strip PropTypes entirely using babel-plugin-transform-react-remove-prop-types? Then this would probably already work via preact/aliases.

threepointone commented 7 years ago

I'm using proptypes not for props, but for reading context vars. how would that work in preact? does preact expose all context vars by default?

developit commented 7 years ago

Preact exposes all context by default, yup. Can safely strip :)