Skip to content

Instantly share code, notes, and snippets.

@developit
Created September 2, 2018 01:43
Show Gist options
  • Save developit/71072a9b421e7d3d15fdbd6935d1a313 to your computer and use it in GitHub Desktop.
Save developit/71072a9b421e7d3d15fdbd6935d1a313 to your computer and use it in GitHub Desktop.
import preact from 'preact';
import PropTypes from 'prop-types';
// installs global prop type checking for app preact components
preact.options.vnode = vnode => {
let Component = vnode.nodeName;
if (Component.propTypes) {
PropTypes.checkPropTypes(
Component.propTypes,
vnode.attributes
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment