Reputation: 132
I'm making a Hotel search form that has a few configuration options.
It takes the number of adults, children, ages of children and some other options. All of this information is disposable; it doesn't require storage to a DB to be recalled at a later date.
I was considering using Sessions, but I read that it's probably best just to use a global JSON object which I'm ok with.
What I want to know is if there is 'meteor way' way to do things with regards to keeping the information up to date. The UI involves addition and subtraction buttons to change the numbers and I want the JSON object to be updated on the fly, there are also other UI elements that should be created such as an 'Age of Child' option each time a child is added.
I'm going ahead with using regular jQuery DOM manipulation at the moment. Should I be using Handlebars and Template helpers instead?
Upvotes: 2
Views: 72
Reputation: 4206
It all depends what you're doing. For instance, if you're doing this all with Sessions, you should use Handlebars & Template helpers. Handlebars and Template helpers react to Session variables, so if you have a Handlebar function that displays a Session variable, the DOM will change when that Session variable does. So if you have data that will be changing, which you do, store that data as a JSON in a Session variable. Access the data using Handlebars, so when the data in the JSON changes, your DOM will react too.
Upvotes: 1