Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old Yesterday, 02:00 AM   #1
markstyne
Registered User
 
Join Date: Dec 2012
Location: Los Angeles
Posts: 210
Facing React Error: Objects are not valid as a React child.

Greetings Everyone! I am currently building a react website for a homeopathic doctor. We are currently working on a part where we have to display the information of homeopathic doctors from the JSON object, but I am getting an error:

Error: Objects are not valid as a React child (found: object with keys {name, degree, specialty}).

Here is the snippet of my component code:
const doctorInfo = {
name: "Dr. Sonal Mehta",
degree: "BHMS",
specialty: "Chronic Illnesses & Depression"
};

return (
<div>
<h2>{doctorInfo}</h2> {/* This line throws the error */}
</div>
);

I think it's related to the rendering of objects, but I am not sure how to fix it. Can anyone help me with the correct way of rendering the data in JSX? Your help will be beneficial.

Last edited by markstyne; Yesterday at 02:04 AM..
markstyne is offline   Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vue might just be a clever copy of React? sahithya Programming General 0 05-06-2024 02:59 AM
VUE vs React sahithya Programming General 0 04-07-2024 11:58 PM
Top 5 popular React packages sahithya Programming General 1 05-20-2022 04:17 AM
Advantages of REACT from practice sahithya Programming General 0 08-30-2021 01:28 AM
Orlando Child Custody Attorneys brownlawpl General Discussion 0 08-26-2016 11:04 PM


All times are GMT -7. The time now is 09:18 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.