【发布时间】:2018-06-18 09:43:16
【问题描述】:
我正在尝试将 Flow 与 React 一起使用。 我收到这两个错误:
错误: 导入'../../assets/css/clientStyle.css'; => 未找到所需模块
错误 属性
sortByLastChangedDate不兼容: 15: const TableComponent = (props: Props) => { ^^^^^ 属性sortByLastChangedDate。找不到属性。请参阅:src/components/client/TableComponent.js:15
.
import '../../assets/css/clientStyle.css';
type Props = { /* ... */ };
type State = {
showClients: boolean,
data: any[],
lastCreated: any[],
};
@observer
export default class Client extends React.Component<Props, State> {
constructor() {
super();
this.state = {
showClients: false,
data: [],
lastCreated: [],
};
}
render() {
return (
<TableComponent
data={this.state.data}
isHeaderWithIcons="true"
title="some title"
sortByCreationDate={this.sortByCreationDate}
sortByLastChangedDate={this.sortByLastChangedDate}
/>
)
}
}
// TableComponent
type Props = {
data: any[],
title: any,
isHeaderWithIcons: string,
sortByCreationDate: () => mixed,
sortByLastChangedDate: () => mixed,
}
const TableComponent = (props: Props) => {
return (
<div className="clients-container">
<h3>{props.title}</h3>
</div>
}
【问题讨论】:
标签: javascript reactjs flowtype