Step one: Download a third-party message subscription and publishing library, such as the commonly used pubsub.js, which can be used in any framework including vue, react, anglar, etc.
Command: npm i pubsub-js
Note that it is pubsub-js (not dot);
Step 2: Import the library;
import pubsub from 'pubsub-js'
Step 3: Subscribe to the message;
Part 4: Receiving messages;
Summarize: