Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Created December 30, 2016 08:03
Show Gist options
  • Save barneycarroll/60c840306ed2d539444fd5864362ca83 to your computer and use it in GitHub Desktop.
Save barneycarroll/60c840306ed2d539444fd5864362ca83 to your computer and use it in GitHub Desktop.
Mithril patch which binds a `state.parent` property to nodes referring to the parent `vnode`
import m from 'mithril'
export default ( ...input ) => {
const parent = m( ...input )
return (
parent.children == undefined
? parent
: Object.assign( parent, {
children : children.map( child => Object.assign( child, { parent } ) )
} )
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment