Created
March 11, 2017 22:41
-
-
Save asolove/87d13aac5e8a38aa47913d2d7b8d5250 to your computer and use it in GitHub Desktop.
getNodeProps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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