React Native: Create Reference to Component
August 20, 2023•45 words
Static Component
No reference usable
var Com = <MyComponent/>;
// Can't access members inside Com
return (
{Com}
);
Component
With usable reference
var Com = React.createRef();
// Access members of Com thru: Com.current.*
return (
<MyComponent ref={Com}/>
);