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

277
Views
Error when using react hooks and transferable objects

I have a hook useWorker which manages a worker. Inside of it i would like to declare something like:

const foo = useRef(new Float32Array(myBufferRef.current))

However, this runs fine once, then an effect runs that posts a message with foo.current.buffer as a transferable object, and then i get:

useWorker.tsx:146 Uncaught TypeError: Cannot perform Construct on a detached ArrayBuffer

It's basically complaining about this useRef (but it fails at useState).

How could i instantiate an ArrayBuffer a Float32Array using it, on a component mount and transfer it to the worker and back during the component's lifetime?

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!