Skip to content

Instantly share code, notes, and snippets.

@asolove
Created March 11, 2017 22:41
Show Gist options
  • Save asolove/87d13aac5e8a38aa47913d2d7b8d5250 to your computer and use it in GitHub Desktop.
Save asolove/87d13aac5e8a38aa47913d2d7b8d5250 to your computer and use it in GitHub Desktop.
getNodeProps
export function getNodeProps(vnode) {
let props = clone(vnode.attributes);
props.children = vnode.children;
let defaultProps = vnode.nodeName.defaultProps;
if (defaultProps) {
for (let i in defaultProps) {
if (props[i]===undefined) {
props[i] = defaultProps[i];
}
}
}
return props;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment