Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Meteor Sessions

  • Last Updated : 31 Dec, 2021

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.

On the client, Session provides a global object that may be used to hold an arbitrary set of key-value pairs. It can be used to save information such as the currently chosen item in a list. When the user exits the app, the data will be removed.


Session.set(key, value);

Run the following command in your terminal to add Session to your application:

meteor add session

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

Step 3: Import Session module from ‘meteor/session’

import { Session } from 'meteor/session'

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.


Example: This is the basic example that shows how to use the Sessions component.


        {{> employee}}
<template name="employee">
    <h1 class="heading">GeeksforGeeks</h1>
        Session provides a global object that may
        be used to hold an arbitrary set of key-value pairs.


import { Session } from 'meteor/session';
import './main.html';
var emp = {
    FirstName: "John",
    LastName: "Smith",
    Age: 10,
    Designation: "System Architecture"
Session.set('data', emp);
var display = Session.get('data');



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!