I wrote some code:
function renderGreeting(Elem: React.Component) {
return Hello, !;
}
If you are using material-ui, go to type definition of the component, which is being underlined by TypeScript. Most likely you will see something like this
export { default } from './ComponentName';
You have 2 options to resolve the error:
1.Add .default when using the component in JSX:
import ComponentName from './ComponentName'
const Component = () =>
2.Rename the component, which is being exported as "default", when importing:
import { default as ComponentName } from './ComponentName'
const Component = () =>
This way you don't need to specify .default every time you use the component.