Skip to content

Instantly share code, notes, and snippets.

@theorm
Created February 11, 2020 09:37
Show Gist options
  • Save theorm/f54ed866b7ec584d086f97bbf48f1573 to your computer and use it in GitHub Desktop.
Save theorm/f54ed866b7ec584d086f97bbf48f1573 to your computer and use it in GitHub Desktop.
<script>
export default {
name: 'test-component',
functional: true,
props: {
children: Array
},
render (h, context) {
return (context.props.children || []).map(child => {
if (typeof child === 'string') return child
return <div style={child.style}>
{child.text}
<test-component children={child.children}/>
</div>
})
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment