Communicating across tabs and windows

Image for post
Image for post

Building a progressive web app (PWA) usually stands for instant access regardless of network state, but a PWA can offer much more through the use of service workers, including state share across multiple browser tabs and windows.

Sharing the state across tabs can have multiple utilities — for this specific example, let’s think about an e-commerce cart that updates every time we add or remove products. We can efficiently achieve a state share across tabs and windows by combining service workers with React Hooks. Let’s explore that.

Hands-On React

We’ll start declaring the cart counter in our state and create the functions responsible to increment and decrement the counter of products on the bag. You can call these functions on a call-to-action button inside your product component, for instance. …


Five basic techniques

Image for post
Image for post

About a year and a half after reaching 1 billion active users, Facebook hit another milestone: over 1 billion active mobile users. Mashable, one of the biggest sources of content about social media, internet news, and digital innovation, published a survey stating that 17.4% of all web traffic comes from mobile devices. This survey was published in 2013, since which time the percentage has steadily crept upward yearly.

Social networks like Tumblr are changing features formerly found only on websites for desktop to mobile platforms, synchronizing both contexts. …

About

Lucas Estevão

Dad, runner, longboarder, kickboxer brown belt, movies lover, Technical Manager and Sr. UI Engineer at Avenue Code, working from Apple.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store