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?
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…
Senior Frontend developer at LawGeex, L0v3 c0d1n9 !