DEV Community

Cover image for Keeping browser tabs in sync using localStorage, NgRx, and RxJS
Tim Deschryver for Angular

Posted on • Edited on • Originally published at timdeschryver.dev

1 1

Keeping browser tabs in sync using localStorage, NgRx, and RxJS

In this post, we're going to take a look at how we can keep application state in sync when a user has multiple tabs open. We're going to make this happen by using the Web Storage API, NgRx (Store and Effects), and RxJS. A basic knowledge of NgRx is needed to follow the examples.

There are two ways of syncing state that I know of. One of them is to send the actions from one tab to another tab, the other is to send the (partial) state from one tab to another tab. While both of them have a very similar implementation, they both shine in their own way.

As a starting point, we're going to pick up where we left off in a previous post "Let's have a chat about Actions and Action Creators within NgRx" where we created a simple grocery list.

Read More...

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

Top comments (0)

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay