Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save developit/0506e121d1245387487a235875a8124e to your computer and use it in GitHub Desktop.
Save developit/0506e121d1245387487a235875a8124e to your computer and use it in GitHub Desktop.

Just import this in your app's index/entry module, before any imports that would bring in preact-material-components.

import { options } from 'preact';
const old = options.vnode;
options.vnode = vnode => {
Object.defineProperties(vnode, ALIASES);
if (old) old(vnode);
};
const ALIASES = {
attributes: {
configurable: true,
enumerable: false,
get() {
return this.props;
},
set(v) {
this.props = v;
}
},
nodeName: {
configurable: true,
enumerable: false,
get() {
return this.type;
},
set(v) {
this.type = v;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment