Elixir liveview1/1/2023 ![]() ![]() There are a couple challenges to face when working with this approach: Obviously, this is a very simple example, and more sophisticated things can be implemented, so give it a try. I found LiveView very easy to work with, and the sensation you get when you are on the user side is that it is fast. There are other libraries that are trying to do something similar in other frameworks (like, for example, Reactor for Django). LiveView is an approach that is gaining traction. You could have several of those parameters and react as necessary in those cases. These values tell LiveView to call the handle_event method with the `filter` parameter. The form has `phx_change: filter` when declared. %,įilter = Map.put(_state, param, value)Īnd, we are done. Modify the template to send the client eventsĪdd the events to the template so we can react to changes: %>Īdd the functions to react to client events: In our case, we can simply add a blank filter (unfiltered data): def mount(_params, socket) do We basically establish what a “stable known state” is. The mount function is where we initialize the LiveView. LiveViews can be attached to routes, controllers or templates. I will go through every point in this list in detail.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |