import { ComponentClass, FunctionComponent, ComponentProps } from "react"; import PropTypes from "prop-types"; import ViewState from "../../ReactViewModels/ViewState"; import { useRefForTerria } from "../Hooks/useRefForTerria"; interface WithTerriaRefProps { viewState: ViewState; } /* HOC to set a ref and store it in viewState */ export const withTerriaRef =

>( WrappedComponent: ComponentClass

| FunctionComponent

, refName: string ) => { const WithTerriaRef = (props: P & WithTerriaRefProps) => { const hocRef = useRefForTerria(refName, props.viewState); return ; }; WithTerriaRef.propTypes = { viewState: PropTypes.object.isRequired }; return WithTerriaRef; }; export default withTerriaRef;