Can someone help me regarding the following problem in the database constructor
I get this:
Unhandled Rejection (TypeError): Illegal constructor
at
initDb();
constructor
const HomeCliente = () => {
const [db, setDb] = useState<Database | null>(null);
const runSet = (nombre:any,data:any) => {
db.set(nombre, data);
}
const runGet = async (nombre:any) => {
return await db.get({nombre});
}
useEffect(() => {
async function initDb() {
const store = new Storage();
const db = await store.create();
setDb(db);
}
initDb();
getItem("primevaCargaProveedores").then(res => {
primeraVezProveedores.current=res
})
runGet("proveedores").then(res => {
if(res!=undefined || res!=null){
arreglo=JSON.parse(res)
}
})
}, []);
}
2 posts - 2 participants