Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda