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

98
Visualizações
React Select Value passing to a function

I have made a Select tag which has default options in it :

Screen shot : https://i.stack.imgur.com/T85LV.png

so i have options listed here :

  const options = [
  { value: 'All categories', label: 'All categories' },
  { value: 'Basic', label: 'Basic' },
  { value: 'Premium', label: 'Premium' },
]

The filter function which is used to differentiate the ntf's :

async function filterCategory(cat) {
        var filterCat = [];
        setshowlist(false);
        if (cat !== "all") {
          filterCat = allTokens.filter(function (el) {
            if (connected) {
              return (
                el.tokendetails.tokenCategory === cat &&
                el.tokendetails.networkVersion ===
                providerChainID.toString()
              );
            } else {
              return el.tokendetails.tokenCategory === cat;         
            }
          });
          setexploreTokens(filterCat);
        } else {
          if (connected)  {
            filterCat = allTokens.filter(function (el) {
              return (
                el.tokendetails.networkVersion ===
                providerChainID.toString()
              );
            });
          } else {
            filterCat = allTokens;
            
          }
        }
        setexploreTokens(filterCat);
        setshowlist(true);
      }    

And the Select Dropdown part where i need to pass All categories or Basic or Premium from what i select :

<div className='dropdownSelect one'>
  <Select className='select1' styles={customStyles} menuContainerStyle={{'zIndex': 999}} 
   defaultValue={options[0]} options={options} onClick={filterCategory({options})}/>
</div>

The issue i am facing is on how to pass either "All Categories " , "Basic" , "Premium" from Select tag to that function filtercat and can filter the nfts ? can anyone guide me thru that ! Appreciate for your help !

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