Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
Why will it not h1 render a variable in my json database

I have a database where it has different rooms and whether each room is booked at a certain time (it's true if its available and false when it's booked). Whenever I try to console.log the value it works perfectly but whenever I try to h1 it or render it it gives me this error on the console:

Uncaught Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.

Here is the code where I attempt to render the value:

fetch('http://localhost:7000/Rooms')
            .then(res => res.json())
            .then(
                (result) => {
                    console.log(result[0].name)
                    result.map((room) => (
                        <div className="bookListing">
                            {console.log(room.Nine.toString())}
                            <p>Booked for: {room.Nine.toString()}</p>
                        </div>
                            ))
                }
            )`

Here is the json database code:

  "Rooms": [
{
  "Nine": true,
  "Ten": false,
  "Eleven": false,
  "Twelve": false,
  "One": false,
  "Two": false,
  "Three": true,
  "id": "room1",
  "name": "K102A"
},
{
  "Nine": true,
  "Ten": false,
  "Eleven": true,
  "Twelve": true,
  "One": true,
  "Two": true,
  "Three": true,
  "id": "room2",
  "name": "K102B"
},
{
  "Nine": true,
  "Ten": true,
  "Eleven": true,
  "Twelve": false,
  "One": true,
  "Two": true,
  "Three": true,
  "id": "room3",
  "name": "K101A"
},
{
  "Nine": true,
  "Ten": true,
  "Eleven": true,
  "Twelve": true,
  "One": false,
  "Two": true,
  "Three": true,
  "id": "room4",
  "name": "K101B"
},
{
  "Nine": false,
  "Ten": false,
  "Eleven": false,
  "Twelve": false,
  "One": false,
  "Two": false,
  "Three": false,
  "id": "room5",
  "name": "K101C"
}

]

Made in React JSx

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!