HHH v4

Hotwire replace content with stream without socket connection

Edit
equivalent Web Development
Public
Rails
hotwire
# app/controllers/foo_controller.rb
class FooController < ApplicationController
  def index
  end
end

# app/views/foo/index.turbo_stream.erb
<%= turbo_stream.replace "foo", partial: "foo/input" %>

# app/views/foo/_input.html.erb
Hello 

# app/views/pages/landing.html.erb
<div data-controller="anything">
  <button data-action="click->anything#foo">Say hell</button>
</div>

<div id="foo">
  change me
</div>


# app/javascript/controllers/anything_controller.rb
import { Controller } from "@hotwired/stimulus";
import { get } from "@rails/request.js"

tomas = () => {
  get("/foo", { responseKind: "turbo-stream" })
}