Hi everyone, I’m new to Elixir & Phoenix and loved the experience so far. However, when looking into Phoenix it seems like the standard way to work with buttons is <%= button "Click me" %> , which creates a tag, and adds data- attributes. Then there’s an onClick listener in app.js that creates a form, injects the attributes and submits it.
Is this a common problem that all Phoenix apps have? Or do people use something else? Or maybe I’m just missing something?
Thanks for your answer and pointing me to phoenix_html.js!
I understand that it would not work outside of forms, my suggestion would rather be to wrap the button with a form right in the template as HTML, not with JS after page load. Is there a reason why Phoenix decided to do it with JS?
This is the way some newer JS frameworks like Remix do it, getting the benefits of a progressive UX - as in everything works without JS from the first load, then it gets enhanced.
It might not be a big deal, but I believe these things could matter to other people like me who came to Phoenix after getting tired of the JS drama. T