Kinsua
Both will change the @something value when it’s changed in real time. Both are “live”.
So what is the difference?
Isn’t the naming a bit unfortunate? Because the normal components change in the live process as well in real time.
This part from docs is super confusing, I don’t know when it’s about compoents and when about liveComponents:
Components have their own mount/3 and handle_event/3 callbacks, as well as their own state with change tracking support. Components are also lightweight as they “run” in the same process as the parent LiveView. However, this means an error in a component would cause the whole view to fail to render. See Phoenix.LiveComponent for a complete rundown on components.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
APB9785
LiveComponent stores mutable state similar to LiveView/GenServer. You can change the state with events that include
phx-target={@myself}and defining event handlers in the LiveComponent module.Phoenix.Component holds no state. It receives inputs, but cannot change those inputs. It is purely “functional”. These functional components cannot be targets of events, and cannot define the event handler logic which would be required to change the state.
Assuming your app has some state:
sodapopcan
I agree the docs wording is confusing. Under one section it talks about both function components and live components. At one point it starts referring to live components as simply “components.” While it can be inferred from context, I found myself thinking it’s referring back to function components before going on to talk about live components.
I can work on a PR to clarify a little.
D4no0
The documentation is mixed because live components used to be located in liveview documentation, there were no functional components back then.
I guess when liveview was added officially to the framework as a default, the documentations got merged and it’s a mess even to this day, as you don’t understand where one feature ends and another starts.
LostKobrakai
Nothing got merged there. LiveComponents as well as function components are a feature of phoenix_live_view and always have been. But the point about LiveComponents having existed for longer than function components does still stand. If things would’ve been the other way round things would certainly look different.
D4no0
Hmm, I always thought that functional components come from classical phoenix and not liveview as they have nothing in common with what liveview does, but it seems you are right.
LostKobrakai
They need to be in live view because change tracking is a concept of live view, which heex integrates with.
D4no0
It’s pretty strange that
heexis still part of liveview. So what, you can’t useheextemplates in a classic phoenix project without adding liveview as dependency?steffend
This is correct. You cannot use HEEx without depending on LiveView. HEEx directly integrates into the LiveView custom EEx engine and is intertwined with LiveView’s change tracking. Trying to separate this would be a lot of work and probably not worth the effort.