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

220
Vistas
How can I import a JS file with special characters in it's name in React and JSX?

How can I import a JS file with special characters in it's name in React and JSX?

I can

import { tomorrow} from 'react-syntax-highlighter/dist/esm/styles/hljs';

(the folder contains tomorrow.js and tomrorrow-night.js)

but I can't:

import { tomorrow-night} from 'react-syntax-highlighter/dist/esm/styles/hljs';

I don't think destructuring works here because it's an import statement.

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

0

you can try as

import * as Highlighter from 'react-syntax-highlighter/dist/esm/styles/hljs';

const TomorrowNight = Highlighter[`tomorrow-night`];
about 4 years ago · Juan Pablo Isaza Denunciar

0

How about using the import * as blah import? That gives you an object that you can then lookup any string in.

import * as tmrw from from 'react-syntax-highlighter/dist/esm/styles/hljs';
const tmrw_night = tmrw['tomorrow-height']
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