I am using react-st-modal library to display modals and I am getting an error while importing a function from this library.
My import statement is:
const CustomDialogPromise = import("react-st-modal").then(
(module) => module.CustomDialog
);
I am getting error:
SyntaxError: Cannot use import statement outside a module
UPDATE I put the import inside useEffect and it dissapeared. Now I'm getting a new error. There is a hook that react-st-modal exports called useDialog and I am importing it in this way:
let useDialog = null;
import("react-st-modal")
.then((module) => module.useDialog)
.then((dialog) => {
useDialog = dialog;
});
But then I get the same error as before.