ReactJS Error Solved: Type Children is Not Assignable to Type IntrinsicAttributes

When you are trying to create a React Component with strongly typed props you may get this error.

Type '{ children: never[]; id: string; label: string; }' is not assignable to type 'IntrinsicAttributes'

This means that you are trying to use component with children and you did not provide any child element.

<TextField id={"firstName"} label={"First name"} >

In above code, it is expecting children because you are not using self closing tag.

If you are not planning to add child element, use the self closing tag syntax and your error will go away.

<TextField id={"firstName"} label={"First name"} />



Leave a Reply

Your email address will not be published. Required fields are marked *