Reactivity
From the Meteor docs:
"Meteor embraces the concept of reactive programming. This means that you can write your code in a simple imperative style, and the result will be automatically recalculated whenever data changes that your code depends on."
See above how the teams helper returns Teams.find()? And remember how by changing Teams (creating, updating or removing teams) would result in the page updating automatically? This is reactivity in play.
How to cook a reactive computation
To make something reactive you need three ingredients:
- a reactive data source (like
Teams.find()) - a function with the reactive data source in it (like the function we passed to the
teamshelper) - a kind of "function upgrader" - something to upgrade the function to be aware that is has to run again when the reactive data source inside it changes (
Templatedoes this for us above)

There are 7 reactive data sources in Meteor, but we only care about the top 2 at the moment:
- Database queries on collections (like
Teams.find()) - Session variables (we will use these in a second)
Meteor.status- The
ready()method on a subscription handle Meteor.userMeteor.userIdMeteor.loggingIn
There are 3 "function upgraders" in Meteor. I'll list them all, but we only care about the top one:
- Templates
Tracker.autorunBlaze.renderandBlaze.renderWithData
So without really understanding it, we have already cooked up some reactivity already by listing our teams. But now we want to use it again for our isCreatingTeam helper. To do this we'll utilize the Session reactive data source.