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

270
Visualizações
I'm making a searchbar component with suggestions, but why is the list I'm rendering for suggestions showing a semicolon as one of the list items?

This is my searchbar with suggestions component that I'm working on:

import React from 'react';
import { FiSearch } from 'react-icons/fi';
import '../CSS/SearchBar.css'
import productsData from './../productsData.json'
import 'bootstrap/dist/css/bootstrap.min.css'
    
class SearchBar extends React.Component {
      constructor(props) {
        super(props);
        this.state = {
          typed:""
        }
    
        this.userTyped = this.userTyped.bind(this);
      }  
    
      userTyped(e) {
        this.setState({
          typed: e.target.value
        })
      }
      
      render() {
    
        return (
          <div className='searchbar'>
            <div className='wrapper'> 
              <input 
              type='text'
              value={this.state.typed}
              onChange={this.userTyped}
              />
    
              <button>
                <FiSearch size={18}/>
              </button>
            </div>
    
            <ul className='list-group suggestions'>
              {productsData.map((item) => {
                return (
                  <button id='list-item' className='list-group-item list-group-item-action'>
                    {item.title}
                    </button>
    
                )
              })};
              
            </ul> 
          </div>
        )
      }
      

}

The map function uses productsData that is a json file with five items in it.

And this is what the semicolon I'm confused about. Its at the bottom of the list: my searchbar

I was wondering if the cause of this is returning my button element, but I wasn't sure how else to go about it.

Would appreciate any help! Pretty new at this.

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