Bowl of Fruit - Click to Select
Five pieces of fruit rendered as SVG circles sit in a row, and clicking one selects it with a black outline. The example demonstrates a stateful selection pattern using D3 v7’s `scaleOrdinal` for color and radius, and a 1000ms transition for entrance, exit, and updates. Over four timed steps, an apple is removed, a lemon replaces an apple, a lemon is added, and another apple is deleted. The `fruitBowl` function handles `enter`, `merge`, and `exit` selections, and `on('click')` triggers a callback to update the `selectedFruit` state.