How can I use JavaScript in Phoenix LiveView?

I don’t understand anything there. Seems like Phoenix is too complicated for me ;(.

Isn’t there any real world example when you want to use JavaScript inside templates of Phalcon?

I don’t want to involve the server at all, all I want to have a simple button click check based on a cookie state. But the problem is that the cookie is for some reason ignored. Defer in script or moving script at the end isnt helping. In plain html it works as stated here: Cookies in Phoenix LiveView not taken into account only after the second F5 refresh