I have read this post [ https://brettdewoody.com/accessing-component-methods-and-state-from-outside-react/ ]
But I don't understand.
that is not working on my source code.
it's my tsx file
declare global { interface Window { fn_test(): void; childComponent: HTMLDivElement; <-- what the... ref type???? }}export default function Contact(): React.ReactElement {.... function file_input_html( i:number ): React.ReactElement { return (<form id={`frm_write_file_${i}`} .... </form> ) }.... return (<div ref={(childComponent) => {window.childComponent = childComponent}}> ....)
it's my external javascript file
function fn_test(){ window.childComponent.file_input_html(3) var element = document.getElementById("ifrm_write_file"); // element.value = "mystyle";}
How can i call file_input_html function?
plase help me ...