Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Error React Native Typescript : Element type 'MutableRefObject'

$
0
0

I have this error with my code :Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'MutableRefObject<never[]>'

Howether I can't resolve it by changing my items.

Here is my code:

const Comp = (props: { items: any[] }) => {  const refs = useRef([]);  return (<>      {props.items.map((i) => (<div key={i} ref={(el) => (refs[i] = el)}>          {i}</div>      ))}</>  );};

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>