Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

278
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda