После создания проекта «Реакция на машинописи» с использованием приложения create-реакции-приложения я выделил в VS Code, что,
Property 'Component' does not exist on type 'typeof React'.
Мой класс выглядит так:
import * as React from "react";
interface Props {
number: number;
}
interface State {
count: number;
};
export default class MyClass extends React.Component<Props, State> {
constructor(public props: Props) {
super(props);
this.state = {
count: 1
}
}
render () {
return (
<div>
{this.state.count}
</div>
);
}
}
если я заменил оператор импорта на импорт React, {Component} с "реагировать";
Я получаю
Module '".../node_modules/@types/react/index"' has no exported member 'Component'
Я установил @ types / реагировать @ типы / реагировать-дом. Есть идеи, почему код VS не может найти этот модуль?