react.dev
react.dev copied to clipboard
[Mistake]: Unused key in useOptimistic code sample
trafficstars
Summary
The code example for useOptimistic hook contains unused key parameter
Page
https://19.react.dev/reference/react/useOptimistic#usage
Details
In the Optimistically updating forms section, inside the code sample there is an unused key parameter, which, apparently, should have been used on the line 25:
<div key={index}>
It's not a mistake, 'key' parameter is used in reconciliation to optimize render performance . And it's right way of writing code when using .map