Open lnicepei opened 3 months ago
The code example for useOptimistic hook contains unused key parameter
useOptimistic
key
https://19.react.dev/reference/react/useOptimistic#usage
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:
Optimistically updating forms
<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
.map
Summary
The code example for
useOptimistic
hook contains unusedkey
parameterPage
https://19.react.dev/reference/react/useOptimistic#usage
Details
In the
Optimistically updating forms
section, inside the code sample there is an unusedkey
parameter, which, apparently, should have been used on the line 25: