TIL: You can process (or trigger) a Turbo Stream response HTML in JavaScript

Today I learned about the Turbo.renderStreamMessage(html) method, which lets you process (append, replace, etc.) a Turbo Stream response received from a fetch request in JavaScript, without manipulating the DOM yourself.

I found it very useful, so thought I should share here, for those who haven’t seen it before.

I also wrote a blog post that shows how it works with an example: How to Process a Turbo Stream Response in JavaScript using Stimulus.

2 Likes