I’m trying to import functions from src/api/api
to src/App.js
.
Here are all of my import statements in App.js
:
import React, { useEffect, useState, useRef } from 'react';
import { fetch_db_files_metadata } from './api/api';
import { fetch_uploads_metadata } from './api/api';
import { start_push_to_DB } from './api/api';
import { start_upload_deletion } from './api/api';
import { start_file_deletion } from './api/api';
import { start_file_download } from './api/api';
import './App.css';
Here are my function headers in api.js
:
export const fetch_db_files_metadata = async () => {}
export const fetch_uploads_metadata = async () => {}
export const start_push_to_DB = async () => {}
export const start_upload_deletion = async (upload_deletion_list) => {}
export const start_file_deletion = async (file_deletion_list) => {}
export const start_file_download = async (file_download_list) => {}
There is no export{}
or export default{}
block at the bottom of api.js
. api.js
only contains the functions.
React.JS does not compile. Here are the error messages:
ERROR in ./src/App.js 59:32-55
Can’t import the named export ‘fetch_db_files_metadata’ (imported as ‘fetch_db_files_metadata’) from default-exporting module (only default export is available)ERROR in ./src/App.js 64:34-56
Can’t import the named export ‘fetch_uploads_metadata’ (imported as ‘fetch_uploads_metadata’) from default-exporting module (only default export is available)ERROR in ./src/App.js 69:33-49
Can’t import the named export ‘start_push_to_DB’ (imported as ‘start_push_to_DB’) from default-exporting module (only default export is available)ERROR in ./src/App.js 79:34-55
Can’t import the named export ‘start_upload_deletion’ (imported as ‘start_upload_deletion’) from default-exporting module (only default export is available)ERROR in ./src/App.js 88:35-54
Can’t import the named export ‘start_file_download’ (imported as ‘start_file_download’) from default-exporting module (only default export is available)ERROR in ./src/App.js 96:32-51
Can’t import the named export ‘start_file_deletion’ (imported as ‘start_file_deletion’) from default-exporting module (only default export is available)webpack compiled with 6 errors and 1 warning
I tried to remove the curly braces, which allows the app to compile but results in runtime errors stating that the functions are not functions when I try to call them.