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

200
Vistas
Can't import d3.hexbin from d3 in react component

I have a similar issue to this post. Unfortunately the solution there has not worked for me. How can I use d3.hexbin inside a react component? I've included it in the dependencies and installed it.

"dependencies": {
"d3": "^7.3.0",
"d3-hexbin": "^0.2.2"

}

I imported d3 originally just like this:

import * as d3 from 'd3';

Other than hexbin I can use most modules and was able to do scatter and bar charts so far. I am fairly new to this, and am sorry if I'm missing something obvious, please let me know. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you're using Typescript, first make sure you have installed @types/d3-hexbin to your devDependencies.

Did you try:

import * as d3 from ‘d3-hexbin’

const hexbin = d3.hexbin

If you already have a d3 instance, you can rename the import like:

import * as d3Hexbin from 'd3-hexbin'

const {hexbin} = d3Hexbin

After importing the library, here is how to destructure and rename in one line:


const {hexbin: d3HB} = d3Hexbin

Here's a working sandbox

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