I want to import Test component into Home but I keep getting the following error:
Module '"/.../src/components/Test"' has no default export. Did you mean to use 'import { Test } from "/.../src/components/Test"' instead?
In the test component I keep getting the following error on exporting Test:
Type '({ name }: Props) => void' is not assignable to type 'FC<Props>'.
Type 'void' is not assignable to type 'ReactElement<any, any> | null'
Test component
import React,{FC} from 'react';
interface Props {
name: string;
}
export const Test:FC<Props> = ({ name }: Props) => {
<div>{name}</div>
};
Home component
import React from 'react';
import Test from './Test'
export const Home = () => {
<div><Test name="example" /></div>
};
tsconfig.json
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["src"]
}