I posted a something similar yesterday but narrowed down the issue since then. I’m new to Meteor, so apologies in advance if this is annoyingly elementary…
I’m working my way through the TODO APP tutorial and have run into a road block getting Reactive to work in step 7. Temporary UI State
When I open the app in my browser, it is properly stylized but without content, and I’m receiving this error message:
After reading simliar forum posts, I tried updating my version of Meteor – still no luck. Can anyone help?
Below is my body.js –
import { Template } from ‘meteor/templating’;
import { ReactiveDict } from ‘meteor/reactive-dict’;
import { Tasks } from ‘…/api/tasks.js’;
import ‘./task.js’;
import ‘./body.html’;
Template.body.onCreated(function bodyOnCreated() {
this.state = new ReactiveDict();
});
Template.body.helpers({
tasks() {
const instance = Template.instance();
if (instance.state.get(‘hideCompleted’)) {
// If hide completed is checked, filter tasks
return Tasks.find({ checked: { $ne: true } }, { sort: { createdAt: -1 } });
}
// Otherwise, return all of the tasks
return Tasks.find({}, { sort: { createdAt: -1 } }); // 4.3 show newest tasks at top
},
});
// 4.2 Add event handler for form submit
Template.body.events({
‘submit .new-task’(event) {
// Prevent default browser form submit
event.preventDefault();
// Get value from form element
const target = event.target;
const text = target.text.value;
// Insert a task into the collection
Tasks.insert({
text,
createdAt: new Date(), // current time
});
// Clear form
target.text.value = ‘’;
},
‘change .hide-completed input’(event, instance) {
instance.state.set(‘hideCompleted’, event.target.checked);
},
});