"A Valid React Element (Or Null) Must Be Returned" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

"A Valid React Element (Or Null) Must Be Returned"

How can I fix this error? I have made a class component for an input field with 2 props but it won't display without an error. https://code.sololearn.com/WxVBWYuBbCNA/?ref=app

31st Aug 2019, 10:07 AM
Clueless Coder
Clueless Coder - avatar
3 Answers
+ 6
No return in the render method of the first component.
31st Aug 2019, 10:36 AM
ODLNT
ODLNT - avatar
+ 5
No return in the Field component render method to be precise
31st Aug 2019, 11:17 AM
Burey
Burey - avatar
+ 3
Coder Basically, I forgot the return keyword in the render function so React through a tantrum full of errors that made no sense. I wish it would tell me that I need to add a return not tell me I'm violating the entire framework.
31st Aug 2019, 1:33 PM
Clueless Coder
Clueless Coder - avatar