rdunk / sanity-blocks-vue-component

[DEPRECATED] Vue component for rendering block content from Sanity
MIT License
71 stars 10 forks source link

Add example of functional component #7

Closed mornir closed 4 years ago

mornir commented 4 years ago

Since Vue 2.5.0, it's very easy to turn Vue template components into functional components by adding the 'functional' attribute. I thought it would nice to add an example here. The advantages are that props don't need to be defined and such components are much cheaper to render.

mornir commented 4 years ago

That's great suggestion! I guess that using <slot/> would also prevent that issue from happening: https://github.com/sanity-io/sanity/issues/1827 So it's no longer necessary to check for "children[0] && children[0].text".

rdunk commented 4 years ago

Thanks for this.