Grokking React Native
0% completed
File System & Storage Access
import { File, Paths } from 'expo-file-system'; const file = new File(Paths.document, 'pending-deliveries.json'); file.create({ overwrite: true }); file.writeSync(JSON.stringify([{ parcelCode: 'PARCEL-1042', deliveredAt: '10:42' }])); console.log(file.name, file.exists); console.log(file.textSync());
pending-deliveries.json true [{"parcelCode":"PARCEL-1042","deliveredAt":"10:42"}]
Those few lines give the courier app something it cannot lose: a list of finished deliveries that survives closing the app, even if the phone has no signal
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%