Public code

hHow can get it that change JSX.Element to HTMLElement

0
0
Screenshot!
Copy Code!
//.tsx const Fuga: React.FC<{}> = (props) => { //Script const target: HRMLElement = document.getElementById("hoge"); // Error: Type 'Element' is missing the following properties from type 'HTMLElement' // "hoge" is JSX.Element const target: HTMLElement = document.getElementById("hoge") as HTMLElement; //no Error return <div id="hoge"></div> }
Back to Home