下面是我的react组件结构(使用TypeScript):
-App.tsx
-NewRequestForm.tsx
-EmployeeInfo.tsx
-AssetInfo.tsx
我试图在NewRequestForm中导入EmployeeInfo和AssetInfo,但是在使用import语句时,两个组件都不可见,但是我可以看到Prop&States接口。
请建议如何在NewFormRequest.tsx中导入子组件
AssetInfo.tsx(child1)
import * as React from 'react';
export interface AssetInfoProps {}
export interface AssetInfoState {}
export default class AssetInfo extends React.Component<AssetInfoProps,
AssetInfoState> {
constructor(props: AssetInfoProps) {
super(props);
this.state = {};
}
public render() {
return <div />;
}
}
EmployeeInfo.tsx(Child2)
import * as React from 'react';
export interface EmployeeInfoProps {}
export interface EmployeeInfoState {}
export default class EmployeeInfo extends React.Component<EmployeeInfoProps,
EmployeeInfoState> {
constructor(props: EmployeeInfoProps) {
super(props);
this.state = {};
}
public render() {
return <div />;
}
}
NewRequestForm.tsx(父母)
import * as React from 'react';
import {} from './EmployeeInfo';
import {} from './AssetInfo';
export interface NewRequestFormProps {}
export default class NewRequestForm extends
React.Component<NewRequestFormProps, any> {
public render() {
return <div />;
}
}
答案 0 :(得分:2)
删除default
关键字以导出EmployeeInfo