Meet Phoenix LiveView!

Meet Phoenix LiveView!
Average rating: 0
(0 votes)

Thanks! You’ve rated this material!

If you didn’t hear anything about using Elixir and Phoenix for building extremely high performance and low maintenance system, we are here to help you. Even more, we can tell you about something new! Meet Phoenix LiveView! It enables rich, real-time user experiences with server-rendered HTML.

Currently LiveView is under active development and we are focused on getting a stable and solid initial version out. For this reason, we will be accepting only bug reports in the issues tracker for now. We will open the issues tracker for features after the current milestone is ironed out.

  1. Currently, LiveView is only available from GitHub. To use it, add to your mix.exs. 
  2. Once installed, update your endpoint’s configuration to include a signing salt. You can generate a signing salt by running mix phx.gen.secret 32
  3. Update your configuration to enable writing LiveView templates with the .leex extension.
  4. Next, add the LiveView flash plug to your browser pipeline, after :fetch_flash
  5. Then add the following imports to your web file in lib/my_app_web.ex
  6. Next, expose a new socket for LiveView updates in your app’s endpoint module.
  7. Add LiveView NPM dependencies in your package.json
  8. Then install the new npm dependency.
  9. Enable connecting to a LiveView socket in your app.js file.
  10. Finally, by convention live views are saved in a lib/my_app_web/live/ directory. For live page reload support, add the following pattern to your config/dev.exs
  11. You can also optionally import the style for the default CSS classes in your app.css file.

For more information see here.

And we have an answer for you to the question of why Phoenix templates make web development so great. Don’t miss!

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

    Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
    Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
    Kharkiv Otakara Yarosha 22, 61000, Kharkiv, Ukraine