tajo / react-range

🎚️Range input with a slider. Accessible. Bring your own styles and markup.
https://react-range.pages.dev
MIT License
859 stars 97 forks source link

React complaining on missing unike key in array of element #181

Closed galop1n closed 3 months ago

galop1n commented 2 years ago

Hi, I am on react-range 1.8.14 and I keep getting the warning on missing unique key from the JSX validation. The warning is emit by rendering children within the renderTrack callback.

My workaround has been to alter the children with {React.Children.toArray(children)} but a proper fix would be appreciated.

I i am doing something stupid, also possible, I am open to advice.

jandolezal71 commented 1 year ago

I just put key from props in my custom thumb component

renderThumb={(props) => (
   <Thumb
    {...props}
    key={props.props.key}
    range={rangeRef.current}
    step={step}
    values={values}
  />
)}
tajo commented 3 months ago

fixed in examples