Meteor is a full-stack JavaScript platform that is used for developing modern web and mobile applications. Meteor has a set of features that are helpful in creating a responsive and reactive web or mobile application using JavaScript or different packages available in the framework. It is used to build connected-client reactive applications.
Tracker is a package that allows templates and other calculations to be quickly replicated when variables, database queries, or other data sources are changed. Tracker.autorun lets us run a function that relies on reactive data sources in such a way that the function is replayed if the data changes later.
Syntax:
Tracker.autorun(function () {
...
});
Â
Creating Meteor Application And Importing Module:
Step 1: Create a React application using the following command.
meteor create foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command.
cd foldername
Project Structure: It will look like the following.
Step to Run Application: Run the application from the root directory of the project, using the following command.
meteor
Example: This is the basic example that shows how to use the Tracker component.
Main.html
<head>     <title>neveropen</title> </head>   <body>     <div>         {{> table}}     </div> </body>   <template name="table">     <h1 class="heading">neveropen</h1>     <p>         Click on the button below to get the         next value of the table of 12.     </p>       <button id="myButton">NEXT</button> </template> |
Main.js
import './main.html'; Â Â let count = 0; Session.set('value', count); Â Â Tracker.autorun(function () { Â Â Â Â let result = Session.get('value'); Â Â Â Â console.log(`12 x ${result} = ${result * 12}`); }); Â Â Template.table.events({ Â Â Â Â Â Â 'click #myButton': function () { Â Â Â Â Â Â Â Â Session.set('value', count++); Â Â Â Â } }); |
Output:
Reference: https://docs.meteor.com/api/tracker.html

