This is a simple example of how to use Server Sent Events to push updates to a client. It updates the Twitter card with the number of likes. The client can also post a like to the server.
- Install the dependencies with
npm install
- Run the React app in
dev
mode withnpm run dev
Assuming you have the backend running from this repo, with the default configuration, you can open the React app using the following URL
http://localhost:5173/?userId={userId}
Where {userId}
is the user id you want to use. The user id is used to identify the user and to keep track of the likes.