This PR to Create-React-App removes React.FC as the return type for components (for the reasoning why, see the PR). Does this mean that ESlint's explicit function return type rule should no longer apply to React components? If so, how would one go about keeping ESlint happy?
You can use React.ReactElement | null as the return type of your function components. That's what React.FC does today.
interface Props {
children: React.ReactNode;
}
const MyComponent = ({ children }: Props): React.ReactElement => (
<div>{children}</div>
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With