Why cant I get variable to display its string? (template)

Hi!
I cant seem to figure out how to get variables from my JS to show through my template. Why wont the variable data show anything?

My main.js file is like this,

import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Meteor } from 'meteor/meteor'
import './main.html';


Template.showData.helpers({
'testfunc':function(){
  var data = "information";

}
});

My main.html is like this

<head>
  <title>Image api</title>
</head>

<body>
{{> showData}}

</body>

<Template name="showData">
  {{data}}
</Template>

Try:

Template.showData.helpers({
  myData () {
    return 'information';
  }
});

<template name="showData">
  {{myData}}
</template>
1 Like