Reputation: 41
I am not able to understand exactly what Template.currentData() do. What I can understand from the documentation is I can use this to pass data from one template to another template but I can't find any example showing how to do that.
Also, I think we can achieve all the functionality provided by Template.currentData() from Session variable. Please let me know if I am wrong about this statement and why?
Upvotes: 0
Views: 735
Reputation: 6018
As the documentation suggests, The purpose of using Template.currentData()
differs in the various utility like either helpers, events or callbacks of templates.
onCreated
, onRendered
, or onDestroyed
callback, returns the data context of the template.event
handler, returns the data context of the template on which this event handler was defined.helper
, returns the data context of the DOM node where the helper was used.NOTE:
Template.currentData()
Establishes a reactive dependency on the result.
You can refer the already existing discussion on SO here
You can click here for more information
Upvotes: 1