How to make it so you can only like something once?

Working on a recipe app, I have a repeating group that displays recipes and enables you to like a recipe. The only problem is that when you like it, you can continuously like it over and over again. Could someone explain a workflow so users can only like the recipe once? Thanks !!

You will have to “store the like” in your database.

  1. Create a database called “likes” with basically 2 columns: user and receipt.

  2. When user A click to like receipt PIE, then you store it in your database.

Now you know what receipts each user liked, so you will be able to display it using a heart icon filled (for liked receipts) or empty (for the others).

And if they click to unlike it, just delete the row from your database :call_me_hand:

1 Like

Thanks so much !

This topic was automatically closed after 70 days. New replies are no longer allowed.