Skip to content

Instantly share code, notes, and snippets.

View NickWickedSick's full-sized avatar
👁️
I see through the bricks, to the sea, crumbling castle

Nikita Renyov NickWickedSick

👁️
I see through the bricks, to the sea, crumbling castle
View GitHub Profile
import { useState, useEffect } from "react";
import { AsyncStorage } from "react-native";
function useAsyncStorage(key, initialValue) {
const [storedValue, setStoredValue] = useState(initialValue);
useEffect(() => {
AsyncStorage.getItem(key)
.then(value => {
if (value === null) return initialValue;