Creating a reaction
Following the creation of our basic template and collection, and with Meteor putting our lists
collection into the reactive context, we can now proceed to watch the reactive programming model in action.
Navigate to our Lending Library page at http://localhost:3000/
and open the browser console window.
In the console, enter the following command:
> lists.insert({Category:"Fraggles"});
You will instantly see the page update. Note that, this time, the full page didn't refresh! This is because, under the hood, Meteor is tracking changes to our reactive context (in this case, the lists
collection) and the template is being updated immediately after a change is made.
Let's make a few more changes. To do this, enter the same Fraggles
command again:
> lists.insert({Category:"Fraggles"});
Just as before, a new Fraggles button will instantly appear:
But, we have too many Fraggles
categories now. There are a lot of Fraggles, but unless you're...