What is the keyword 'this' stand for in onCreated, onRendered, helpers, events?


In Template’s onCreated, onRendered, helpers, events, what is this and this.data stand for?

what is the difference between this and Template.instance() ?
what is the difference between this.data and Template.currentData() ?

And it seems no matter in where Template.instance().data always equals to Template.currentData() ?

I’m totally confused.


this refers to the current context, try use a differnet function inside a template and voila this inside the function has different “meaning” so either you store it inside a variable or use Template.instance() to get the context inside the function.

Template.instance().data === Template.currentData() cause currentData() is just a short hand for Template.instance().data.


keep in mind Template.currentData() is reactive