在进行调试时,在手机上...如果我将某些内容保存在redux-persist上,那么我将更改一些代码并保存并运行: {
score: 2,
views: 21,
type: 'link',
ranking: 2.7183885087703956,
sponsored: false,
_id: 5ea1947ebbb15d001c408c4d,
title: 'Why a âreturn to normalâ could mean disaster for the stock market - MarketWatch',
url: 'https://www.marketwatch.com/story/why-a-return-to-normal-could-mean-disaster-for-the-stock-market-2020-04-22',
thumb: 'https://s.marketwatch.com/public/resources/images/MW-IE973_corona_ZH_20200422114239.jpg',
author: {
karma: 3910,
subscriptions: [
5e4dad2e5a6930001d9bad99,
5e9a298303c86d001c8cf584,
5e9aae5d03c86d001c8cf5b9,
5e9aa4d703c86d001c8cf5b4,
5e622896def3ed002821b9bf,
5e507210bdbc8100286fbeee,
5e4e3a4d5a6930001d9badb0,
5e9da81bd0ff32001c5fd0b9,
5e9eecf3ef8abb001ddc2696
],
_id: 5e782cb248f8c00027f14f10,
username: 'marcolanz',
password: '$2a$10$qDEn46Qr0uGr0pGDP5FWO.aD411ARsOdVJpgzevWAgz1XR0tUW6kK',
created: 2020-03-23T03:27:46.936Z,
__v: 0,
ip: '201.21.39.32',
bitcoinAddress: '1EsBjmHakFkTnRxxcsB8M1hNHdUnyLg2w7',
links: []
},
category: {
subscriberCount: 2,
nsfw: false,
_id: 5e9eecf3ef8abb001ddc2696,
name: 'StockMarket',
description: 'Stock market',
owner: 5e782cb248f8c00027f14f10,
created: 2020-04-21T12:54:11.398Z,
__v: 0
},
votes: [
{ user: 5e782cb248f8c00027f14f10, vote: 1 },
{ user: 5e92618ba33715001c54530b, vote: 1 }
],
comments: [],
created: 2020-04-23T13:13:34.989Z,
text: null
}
...当应用程序的新版本加载时我仍然可以看到以前保存的数据。
这是否意味着redux-presist可以作为数据库的替代品,以便即使在Appstore中更新App之后,保存的数据仍将保留在设备中,并可供更新的App访问?
答案 0 :(得分:1)
据我所知,它会将商店保存到AsyncStorage
中,该商店使用应用程序的沙箱,无论哪个版本,该沙箱只能由您的应用程序访问(应用程序ID,只有该ID可以访问该沙箱)。这是不同的,我不会将其视为替代品,而是作为数据库的补充。这并不意味着您不能尝试这样使用它。