DEV Community

Cover image for react.children.only expected to receive single react element child
Reactjs Guru
Reactjs Guru

Posted on

react.children.only expected to receive single react element child

react.children.only expected to receive single react element child is the error which we might have faced somehow or someday. This error often occur when we try to add multiple children, or you can say tags inside the JSX code. It often occurs when we put two tags or children inside the return() of any component in simple react codes. Also, you may face this error when you use some library which expects only one child.

You can solve this error using react fragment or using

.

Let’s take a simple example when this problem will occur:

Read full article here

Top comments (0)