I am using Typescript with React JS.
let's say if I have a React functional component:
function MyFunction(){ const myArrowFunction = () =>{ return(<div><p>Some Paragraph</p></div> ); }; //In JavaScript, I would do this to call it the function by reference and it works. //In TypeScript, when I do the same, I do not see the "Some Paragraph" visible on the screen return(<main> {myArrowFunction}</main> );}
calling the function with parenthesis works in Typescript:
return(<main> {myArrowFunction()}</main>);
In JavaScript, I would do this {myArrowFunction} to call it the function by reference and it works.In TypeScript, when I do the same, I do not see the "Some Paragraph" visible on the screen
What is the best way to call a function by reference in Typescript?
Thanks.