Closed paultannenbaum closed 4 years ago
Hi @paultannenbaum!
why
handle_event
methods onSurface.{LiveComponent, LiveView}
dont use bracket notation the same way Surface.Component does?
They do :)
Component properties (no matter in what type of component) can either receive a literal like "hide"
or an expression like {{ @hideEvent }}
, where @hideEvent
is just syntactic sugar for assigns.hideEvent
.
The golden rule is:
{{...}}
to pass expressions i.e., code that will be evaluated at runtime (any valid Elixir expression is accepted)"..."
to pass literal strings.Thanks for the reply. That makes sense, I guess where I was thrown off is the magic that is happening in a click
attribute, where passing it a string invokes the message that ultimately calls the callback function of the string literal, which to be fair is what is happening in phoenix-liveview.
Is there a slack or discord channel for the development of this project? I'd be happy to pick up a couple of these issues, but would want to discuss designs before opening up a PR
Hey @paultannenbaum!
Is there a slack or discord channel for the development of this project?
Not yet. Sorry. I'll consider doing that when we have more contributors :)
I'd be happy to pick up a couple of these issues, but would want to discuss designs before opening up a PR
That's awesome! Feel free to drop any question you might have on any existing issue or open new ones if you need. If at some point we need to have a chat, we can arrange that too.
Cheers.
Hi @msaraiva, this is an awesome library! I def plan on contributing to this project.
One initial question I have looking over the docs, is why
handle_event
methods onSurface.{LiveComponent, LiveView}
dont use bracket notation the same waySurface.Component
does?In this documentation, for a
Surface.Component
a click handler is set like this:Where as on a
Surface.{LiveComponent, LiveView}
it looks like this:I personally find this pretty confusing, as well as harder to parse what is markup versus executed code (I realize it all is actually a sigil that is intepreted and executed, but I hope you get the gist of what I am getting at).
Why not just have all Surface modules use bracket syntax for consistency?