How do I can get a user click a button once?

Hey, I’m trying to make a feature where the user can ‘like’/‘upvote’ something (a post) only once, the procedure is :
is clicked ‘true’?
if no user clicks the button
clicked = true

the problem that I have, is that ‘clicked’ resets (after exiting the post [modal]) and doesn’t hold his value.
How do I overcome this? Do you have any efficient ideas that can replace this?
I’m using firebase btw .

A way you can do this is have the component “likes” (which I assume is stored in a larger Object for the post) be an array of user tags. This way when you load the page you can have a check to see if the user has already liked the post and it also gives you the opportunity to see who liked it.

I thought of it as an option, but it doesn’t really seem efficient… thanks for you reply :slight_smile:

It seems less efficient but it saves space when you think about having to save random data under both the post’s object and the player’s object. Unifying the data in one spot is probably the best option. Hope you get something to work!

Ok, i’ll try it. Thank you for you time and advice!!