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

212
Views
react native possible uhandled promise rejection

im getting the following errors Possible Unhandled Promise Rejection (id: 0): TypeError: user.slice is not a function. (In 'user.slice()', 'user.slice' is undefined)

I need the code to be able to pass the data too return the list of users in order of most matching elements to least. I was able to get the function working in replit with a made up data base once I try to put it in my project I am getting trouble, please help.

 auth().onAuthStateChanged(user => {
          if (user) {
            // User is signed in, see docs for a list of available properties
            // https://firebase.google.com/docs/reference/js/firebase.User
            const profile = getUserProfile(user.uid);
            profile.then(pro => {
              const addy = pro.Address;
              setAddress(pro.Address);


              const filterdUsers = FBusers.filter(user => {
                if(user.Address === addy && user.uid !== p  pro.uid){
                  
                    const items = new Set(pro)
                    
                    const rank = arr => arr.filter(user => items.has(user)).length
                    
                    return (a, b) => rank(b.items) - rank(a.items)
              
                  
                }
                  const sorted = user.slice().sort(filterdUsers(pro))
                  
                  console.log(sorted.map(user => user.items.join(', ')))
                }
              )}};
              // sort users
              //setUsers(sortByMatch);
              //vvv delete me vvv
              setUsers(filterdUsers);

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

user is an object here and you can't slice an object. You can only slice an array or string

JavaScript Array Slice()

JavaScript String slice()

about 4 years ago · Juan Pablo Isaza Report
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!