我在 React 组件中有一个渲染方法:
import * as React from "react";
import MediaService from "./service/MediaService";
import ComponentLifecycle = require("@types/react");
import DOMHelper from "../helpers/DOMHelper";
export default class PictureTaker extends React.Component implements ComponentLifecycle {
// Not important
render () {
return (
<article>
<video id="ra-video">
Video not supported
</video>
</article>
);
}
}
它标记id
为attribute id is not allowed here
,但是好的 - 我明白了。我想重构代码以提取<video>
到另一个组件:
import * as React from "react";
export default class VideoPlayer extends React.Component {
constructor () {
super();
}
render () {
return (
<video id="ra-video">
Video not supported
</video>
);
}
}
但它打破了消息:unresolved type video
。这是它的样子:
代码VideoPlayer
是从 粘贴的PictureTaker
,这让我很吃惊。我有React
:
并且React DOM
:
里面Settings / Languages and frameworks / Javascript / Libraries
。你看到我犯了什么错误吗?预先感谢您的每一个答案。