import { FC, useRef } from "react";
const data: { id: number; name: string }[] = [
{
id: 1,
name: "Первый"
},
{
id: 13,
name: "Тринадцатый"
},
{
id: 20,
name: "Двадцатый"
}
];
const App: FC = () => {
const divRef = useRef<HTMLDivElement>(null);
console.log(divRef.current);
return (
<>
{data.map((item) => (
<div ref={item.id === 13 ? divRef : undefined} key={item.id}>
{item.name}
</div>
))}
</>
);
};
export default App;