0
我是ReactXP
的新手,我正嘗試使用Microsoft ReactXP
框架創建一個小應用程序。我想將關鍵值對保存在本地存儲中。微軟提供了一個名爲存儲 https://microsoft.github.io/reactxp/docs/apis/storage.html https://github.com/Microsoft/reactxp/blob/master/src/web/Storage.ts如何使用ReactXP存儲API?
,我試圖用它作爲
onLoginPressed(){
const user = new User(this.state.userEmail, this.state.password);
RestClient.login(user).then(success => {
alert(success.message);
Storage.setItem('userEmail', success.userInfo.userEmail);
}).catch(error => {
alert('Error in login');
});
}
的API,但它顯示,因爲資料不全的錯誤
ERROR in [at-loader] ./src/Login.tsx:102:21
TS2339: Property 'setItem' does not exist on type '{ new(): Storage; prototype: Storage; }'.
我不能用它。有誰能夠幫助我?