Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

100
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

7 months 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

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos