Let’s say I have a Choose Your Own Adventure Book as static HTML files, numbered 001.html
through 100.html
, all with HTML links connecting them together in a directed graph.
I’d like to build a LiveView project with the same functionality. Assume the HTML files are long enough that I want to keep the contents in their own files, not in an in-line template inside the LiveView.
I thought I could use a LiveComponent with the name of the template file to be rendered somewhere in the assigns, and then render it with something like Phoenix.View.render/3
– but the Phoenix.View
module isn’t available to LiveView and I don’t want to go messing around adding it in myapp_web.ex
without knowing what I’m doing.
I also tried dynamically loading a component with <MyComponentsModule.#{@section_number} />
, but that’s just an invalid tag.
I do feel like I’m missing something obvious here. What’s the idiomatic way to do this?