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

251
Views
Change callback name returned from react hook

I want to use stop function in useSound Hooks in diffrent name because I alredy used stop variable.

Use Sound Doc

import play from "./assets/play.mp3";

const [Phone,{stopPhone as stop }] = useSound(phone);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You should use Object desctructoring like so:

const [Phone, { stop: stopPhone }] = useSound(phone);
about 4 years ago · Juan Pablo Isaza Report

0

If useSound returns an array, there should be no need to "rename" any of its items - simply put in the names you want into the destructuring syntax:

const [Phone,stopPhone] = useSound(phone);

you can simply choose whatever names you wish.

If it returns an object you can use object destructuring as follows

const [Phone,{ stop: stopPhone }] = useSound(phone);
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!