I usually have a simple public API for each component that needs to be talked to. Something like:
defmodule LiveComponentTwo do
######### Public API
def update_text(id, text) do
send_update(__MODULE__, id: id, update: :update_text, text: text)
end
#########
def update(%{update: :update_text, text: text}, socket) do
# I suppose here you could check if the value in the socket is empty
{:ok, assign(socket, :text, text)}
end
def update(assigns, socket) do
{:ok, assign(socket, assigns)}
end
end
then, LiveComponentTwo.update_text("id_of_the_component", "text")
Notice that I add a key update: :update_text and then pattern match on that key in the update callback.


















