Version "typescript": "^3.9.5" "@types/react": "^16.9.36", Property 'FC' does not exist on type 'typeof React I'm all out of ideas.
In .tsx files that contain react, I am continually getting the errors:
Property 'FC' does not exist on type 'typeof React'.
and
I get this in every .tsx file that contains react.
I know it has to be some combination of my Visual Studio configuration and the project config.
Anyone have any ideas for what to check that would only affect some workstations? I can provide as much as I can without giving away company info.
Encountered this problem due to syntax error on my end. If you are migrating from React native to the typescript one, check whether you converted the following properly:
function Counter(props: {initialCount: string}) {
...
}
to
interface CounterProps {
initialCount: string
}
const Counter : React.FC<CounterProps> = (props: CounterProps) => {
...
}
If this does not solve the problem then check whether the React that is getting imported, from where is it getting imported?
FC can be found in @types/react in node_modules/@types/react/index.d.ts/React
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With