Photo by Xavi Cabrera on Unsplash

Lately, I’ve been deliberating what would be a better course of action for using common props between a couple of components that are not necessarily siblings or close to each other on the DOM tree.
I thought about drilling props to relevant components but realize that I don’t really want to render every component on the way when some props are changing.

The issues I am attempting to resolve are:

Photo by Lynda Hinton on Unsplash

The Story is starting while we decided to push some react projects into our product, for some features.
Until version 16.8 we used to create classes while creating components with states, we used the different lifecycles hooks and function components for pure things that don’t require any stages or lifecycles with no states.
In React 16.8, a new feature was added and let the developers another strategy to work with.
No more classes are needed, from this version writing function components with hooks that replace the lifecycle methods is the new kid in town.

What is the motivation behind it?

Photo by Clark Tibbs on Unsplash

Notification service is one of the most common services in every application.
It allows the users to receive live information that is relevant to them.

I will demonstrate an implementation for notification service that uses RXJS subject and observable.

But first, why do we need subject? And why observable? And how should we get notified?

Let’s give a simple example first.

Imagine that you have registered for some magazine. So, you are expecting to get every magazine that gets published, but how does that mechanism work?

First, when we just registered for that magazine, we subscribed or provided details, like…

Yaron Galperin

Senior Frontend developer at LawGeex, L0v3 c0d1n9 !

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