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

96
Views
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
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!