我正在使用 React Js 和 Appwrite 创建一个网站,但我不断收到错误:- HomePage.jsx:2 未捕获的语法错误:请求的模块 '/node_modules/.vite/deps/appwrite.js?v=47c77f22' 未提供名为 'createClient' 的导出(位于 HomePage.jsx:2:10)
import { createClient } from 'appwrite';
const client = createClient({
endpoint:'',
project:'',
});
当我尝试运行我的代码时,我只能看到白页和未捕获的错误。
我认为this文档提供了有关如何使用appwrite的足够示例。相反
createClient
尝试使用 Client
import { Client, Account } from "appwrite";
const client = new Client();
const account = new Account(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
const promise = account.get();
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});