• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

175
Vistas
How to take path of a folder in src folder in react js?

I am creating a react.js application and in src folder i have creater two folders one for components and one for api. Now I want to import my data from a file that is in api folder how do I get the path of it? because I am trying '../../api' but got an error with this line. Please help! Below is the error.

enter image description here

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

0

You should right-click the required file in the API folder in vscode and click on get relative path(make sure the file where you want to access the API folder is the active file) also you need to use 3 ../ as from the first you go to cards and then componenets and then src folder where the api folder resides but from your error picture you haven't specified a file name and you can import a whole folder so you need to specific a filename after ../../api like ../../../api/script.js

about 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda