I pass a JSX element to a function as a prop(in typescript), and to make a re-usable wrapper, I wish to do some repeatable calculation inside the renderit function:
function renderit({component: JSX.element}) {
// need to do some calculation using dom node here
return <>{component}</>
}
renderit(<div>someobject</div>)
However, in react, to do this, I need a ref(useRef) to be assigned to the component. How do I assign a ref to the component
inside the renderit
function?