react-secure-storage icon indicating copy to clipboard operation
react-secure-storage copied to clipboard

Type Error

Open HakanSungur opened this issue 1 year ago • 1 comments

I'm using React 18 under the Remix Framework and configuring it with Vite. My necessary keys are written in the .env file. I am importing secureLocalStorage like this: import secureLocalStorage from "react-secure-storage"; I am using it like this: const userId = secureLocalStorage.getItem("userId"); I'm encountering this error: TypeError: vite_ssr_import_2.default.getItem is not a function. I would appreciate your help. Also, in my Vite configuration, the following exists:

  "process.env": {},
  global: {},
}

Node v20.15.1

HakanSungur avatar Oct 01 '24 18:10 HakanSungur

I'm using React 18 under the Remix Framework and configuring it with Vite. My necessary keys are written in the .env file. I am importing secureLocalStorage like this: import secureLocalStorage from "react-secure-storage"; I am using it like this: const userId = secureLocalStorage.getItem("userId"); I'm encountering this error: TypeError: vite_ssr_import_2.default.getItem is not a function. I would appreciate your help. Also, in my Vite configuration, the following exists:

  "process.env": {},
  global: {},
}

Node v20.15.1

Did you found a workaround or solution?

bryanjtc avatar Jun 22 '25 18:06 bryanjtc