caseywebdev / react-list

:scroll: A versatile infinite scroll React component.
https://caseywebdev.github.io/react-list
MIT License
1.96k stars 176 forks source link

Switch away from string refs? #248

Closed narthur closed 2 years ago

narthur commented 2 years ago

The itemsRenderer callback is defined as accepting a string ref. However, according to this article, string refs are deprecated and may be removed from React at some point.

The legacy way of creating refs in a React application is using string refs. This is the oldest method and is considered legacy or deprecated because it will be removed in future releases of React.

I can across this when I was having trouble using a Material UI component in itemsRenderer because it explicitly does not accept string refs. I did find a solution, but it raised this question in my mind.

caseywebdev commented 2 years ago

The itemsRenderer callback is defined as accepting a string ref.

Not sure where you see this? It is passed a function.

https://github.com/caseywebdev/react-list/blob/d955cc19ae5edc48c9f404981bd4398c4adb763c/react-list.es6#L507