Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda