col16
Type '() => JSX.Element' is not assignable to type 'Element'
I'm in the process of upgrading some code I wrote 2 years ago. I have many instances of the following pattern in my codebase, where I've embedded logic (of various types) directly within the JSX output. Typescript is now complaining that
Type '() => JSX.Element' is not assignable to type 'Element'
. The code continues to work fine, but the TS error really bugs me! What's the solution? I want to minimise the amount of code re-working necessary because it affects so many files. But I also want to maintain the reactivity.
7 replies