Like and Unlike button on every submitted post

I have a website running on a localhost, its basically login and sign up form and after users log in or sign up they can submit posts, pretty simple, but I need to add like and unlike to every submitted post, I already tried with some codes from GitHub and Google, also tried it by myself, but didn’t had any luck.

So if anyone knows some simple code if there is, and how can I actually add like and unlike to every submitted post, I can post more of my code if you need it, thanks in advice

I can add unlike like code example that I used if it helps

If you already created users and posts, then it should be easy to create likes and unlikes, in your database you’ll have a likes and a unlikes table, each one will reference a post id and a user id (who liked/unliked). In the UI you just count how many likes and unlikes the post has.

That’s one way it could be done.