admin管理员组文章数量:1389768
New to TypeScript and this feels like it should be really simple but I can't quite get the syntax happy!
Very simple ponent:
import * as React from "react";
import ControlArea from "./ControlArea";
interface IControlAreaProps {
wele?: any;
}
export class Layout extends React.Component<IControlAreaProps> {
public render() {
return (
<ControlArea wele="This is the control area"/>
);
}
}
I'm getting the TS error Property 'wele' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ControlArea> & Readonly<{ children?: ReactNode; }>...'.
Any point in the right direction would be very much appreciated.
New to TypeScript and this feels like it should be really simple but I can't quite get the syntax happy!
Very simple ponent:
import * as React from "react";
import ControlArea from "./ControlArea";
interface IControlAreaProps {
wele?: any;
}
export class Layout extends React.Component<IControlAreaProps> {
public render() {
return (
<ControlArea wele="This is the control area"/>
);
}
}
I'm getting the TS error Property 'wele' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ControlArea> & Readonly<{ children?: ReactNode; }>...'.
Any point in the right direction would be very much appreciated.
Share Improve this question asked Feb 20, 2018 at 17:18 wa-rren-devwa-rren-dev 3271 gold badge4 silver badges12 bronze badges1 Answer
Reset to default 3Your mistake here is that you're adding the interface to the Layout ponent when you should be adding them to the ControlArea ponent
interface IControlAreaProps {
wele?: any
}
export default class ControlArea extends React.Component<IControlAreaProps> {
// Your ControlArea code
}
本文标签:
版权声明:本文标题:javascript - React Typescript property does not exist on typeIntrinsicAttributes & IntrinsicClassAttributes - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744695596a2620257.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论