Hello friends,
The turbo handbook enumerates various turbo stream actions - but two of them seem very similar: “replace” and “update”. It is not altogether clear to me what the differences between the two are.
<turbo-stream action="replace" target="message_1">
<template>
<div id="message_1">
This div will replace the existing element with the DOM ID "message_1".
</div>
</template>
</turbo-stream>
<turbo-stream action="update" target="unread_count">
<template>
<!-- The contents of this template will replace the
contents of the element with ID "unread_count". -->
1
</template>
</turbo-stream>
Looks like both kinda do the same thing: when would you use one over the other, and what are the differences between the two?
Any pointers much appreciated. chrs