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

263
Views
React-Native: debouncing async function with lodash

in my react-native app I update user settings using a slider, I don't want to make an axios call everytime a user slides an option so I want to use lodash debounce.

For some reason I'm getting the following error within my debounce function:

Expected a function

My code:

const handler = useCallback(_.debounce(editUserData, 2000), []);
    
    const onSlideChange = (slideIndex) =>
    {
        setActiveSlide(slideIndex);
        handler();
    };

    const editUserData = async () => 
    {
        setLoader(0);
        try
        {
            setLoader(1);
            let url = env.BASE_URL+'/api/users/update-user-settings';
            let payload = { user_id:1 };
                
            let response = await http.post(url, newPayload);
            setLoader(2);
            
            navigation.goBack();
        }
        catch(error)
        {
            setLoader(3);
        }    
    }
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!