# decorateWidget does not return vDom element

**URL:** <https://meta.discourse.org/t/decoratewidget-does-not-return-vdom-element/46680>\
**Category:** Development\
**Created:** [30 Junio, 2016 20:36 UTC](https://meta.discourse.org/t/decoratewidget-does-not-return-vdom-element/46680 "2016-06-30T20:36:29Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![stevenpslade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stevenpslade/32/53550_2.png) [@stevenpslade](https://meta.discourse.org/u/stevenpslade)\
**Post date:** [30 Junio, 2016 20:36 UTC](https://meta.discourse.org/t/decoratewidget-does-not-return-vdom-element/46680/1 "2016-06-30T20:36:29Z")

</div>

Continuing the discussion from [Accessing topic.views from widget or plugin initializer](https://meta.discourse.org/t/accessing-topic-views-from-widget-or-plugin-initializer/46642):

I was encountering issues, as per the linked topic and I have boiled it down to this:

I cannot seem to return a virtual-dom element to `api.decorateWidget` from within a function.

As an example, this works:

```
api.decorateWidget('post-meta-data:after', dec => {
  return h('i.fa.fa-eye')
});

```

But **this** do **not** work:

```
api.decorateWidget('post-meta-data:after', dec => {
  function doThis() {      
    return h('i.fa.fa-eye')
  }
  doThis();
});

```

Can’t figure out why?

---

_[View the full topic](https://meta.discourse.org/t/decoratewidget-does-not-return-vdom-element/46680)._
