相关疑难解决方法(0)

TypeScript属性'props'不存在

我有这个.tsx文件

import React, { Component } from 'react';

export class SidebarItem extends Component {
    constructor (props) {
        super(props);
    }

    render () {
        return (<li>{this.props.children}</li>);
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,TypeScript会抛出此错误: error TS2339: Property 'props' does not exist on type 'SidebarItem'.

typescript react-jsx

8
推荐指数
3
解决办法
9368
查看次数

标签 统计

react-jsx ×1

typescript ×1