Skip to content

[React] React.FC doesn't allow bare return of children #33006

Description

@dontsave

in "@types/react": "^16.8.2"

this works:

export class Test extends React.PureComponent<void, void> {
	render() { 
		return this.props.children;
	}
}

but this doesn't work:

export const Test:React.FC<void> = p => {
	return p.children;
};

seems like the functional component should allow bare return of children just as the class component does. Perhaps a mismatch between the ReactNode and ReactElement types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions