Getting issue with meteor default app, button click counts again to 0 when refresh browser


#1

I am using latest meteor on my win8.1 machine, I installed meteor with meteor window installer
I created app with meteor create demoapp than cd demoapp after that start app with meteor
app started at http://localhost:3000/
I can access my app through browser but I am facing issue
when I click button, button count values increase but when I refresh browser it again ti 0

Thanks in advance for help


#2

The counter variable is re initialized to 0 on your refresh.
Check code.


#3

I didn’t make any change in code , just a default app code


#4
Template.hello.onCreated(function helloOnCreated() {
  // counter starts at 0
  this.counter = new ReactiveVar(0);   <<< SET COUNTER TO ZERO
});

#5

ok will you let me know file location where I have to look for this code


#6

You are kidding me ?? Are you ?

Look into the demoapp folder you created with metero create command. Look for js file.


#7

yes
to create app meteor create demoapp
to access app directory cd demoapp
to start app meteor
is I am going wrong
I absolutely new to meteor/node, just started learning :slight_smile:


#8

which js file I have to check


#9

The default code in the demoapp defines a reactive variable that is stored in the RAM of your computer, and is then reset when you restart your application (in the case of a web application, refreshing the page restarts it).