import * as React from "react"; export interface IconProperties { icon: string | JQuery; } export class IconRenderer extends React.Component { private readonly icon_ref: React.RefObject; constructor(props) { super(props); if(typeof this.props.icon === "object") this.icon_ref = React.createRef(); } render() { if(!this.props.icon) return
; else if(typeof this.props.icon === "string") return
; return
; } componentDidMount(): void { if(this.icon_ref) $(this.icon_ref.current).replaceWith(this.props.icon); } componentWillUnmount(): void { if(this.icon_ref) $(this.icon_ref.current).empty(); } }