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

React Native Typescript - Problem with Ref type

$
0
0

I'm trying to pass down to my component a ref but I'm having some problems with typescript types.. If someone could help it will be much appreciated


./Privacy.tsx

const Privacy = () => {

const buttonRef = useRef();return <Button title="test" ref={(ref) => buttonRef = ref}/>

}


./Button.tsx

type Props = {title: string,ref?: What do i need to put here?}

const Button: React.FC = ({ title, ref }) => {

return <View ref={ref} />

}


Viewing all articles
Browse latest Browse all 6213

Trending Articles



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