updateFruit = (svg, data) => {
const t = svg.transition().duration(750)
const node = svg
.selectAll(".imgs")
.data(data, (d, i) => d.key)
.join(
enter => enter.append("image")
.attr("x", 0)
.attr("y", 0)
.attr("width", (d) => 10)
.attr("height", (d) => 10)
.call(enter => enter.transition(t.delay((d, i) => 100 * i))
.attr("x", (d, i) => 10 + i * 100)
.attr("y", 50)
.attr("width", 100)
.attr("height", 100)
),
update => update
.call( update =>
update.transition(t.delay((d, i) => 100 * i))
.attr("x", (d, i) => 10 + i * 100)
.attr("y", 50)
.attr("width", 100)
.attr("height", 100)
),
exit => exit
.call(exit =>
exit.transition(t)
.attr("height", 10)
.remove()
)
)
.attr("class", "imgs")
.attr("href", (d) => `${imgRoot}${d.key}.svg`)
return svg.node()
}