Programming Phoenix LiveView: updating item in the list (page 200)

Updating a product in the list is done this way in the book

def handle_rating_created(
%{assigns: %{products: products}} = socket, updated_product,
product_index
) do socket
|> put_flash(:info, "Rating submitted successfully") |> assign(
:products,
    List.replace_at(products, product_index, updated_product)
  )
end

but I see this as an opportunity to teach temporary assigns because those weren’t mentioned in the book. Or maybe this could be an exercise for the reader.