I hereby claim:
- I am theobr on github.
- I am nottheo (https://keybase.io/nottheo) on keybase.
- I have a public key ASAA3CySsM7igLpj__FeNQ98lPL_UwG7BXam_pVAlwWYzQo
To claim this, I am signing this object:
export const useGetUserProfile = (userId: string) => { | |
return useQuery(["user-profile", userId], async () => { | |
return await fetch("/user/"+userId); | |
}); | |
} |
// /pages/index.tsx | |
function ExamplePage() { | |
const { data } = useBackend( | |
"get-user-info", | |
async () => { | |
const data = await getProfileFromDB(); | |
return data; // {name: string} | |
}, | |
{ prefetch: true } |
import { atom, useAtom } from "jotai"; | |
const atomWithSyncedLocalStorage = <T>(key: string, initialValue: T) => { | |
const baseAtom = atom(initialValue); | |
baseAtom.onMount = (setValue) => { | |
const storageUpdateListener = (e: StorageEvent) => { | |
if (e.key === key) { | |
console.log("Updating instance of ", key, " remotely"); | |
setValue(e.newValue ? JSON.parse(e.newValue) : undefined); | |
} |
diff --git a/node_modules/pubnub-react/.DS_Store b/node_modules/pubnub-react/.DS_Store | |
new file mode 100644 | |
index 0000000..c31aa91 | |
Binary files /dev/null and b/node_modules/pubnub-react/.DS_Store differ | |
diff --git a/node_modules/pubnub-react/dist/.DS_Store b/node_modules/pubnub-react/dist/.DS_Store | |
new file mode 100644 | |
index 0000000..5008ddf | |
Binary files /dev/null and b/node_modules/pubnub-react/dist/.DS_Store differ | |
diff --git a/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js b/node_modules/pubnub-react/dist/pubnub-react.cjs.development.js | |
index 8017ac7..20b50d8 100644 |
I hereby claim:
To claim this, I am signing this object:
const useChromeStorage = (key, initialValue) => { | |
const [storedValue, setStoredValue] = useState(() => { | |
chrome.storage.sync.get([key], result => { | |
if (result && result[key] !== undefined) { | |
setStoredValue(result[key]); | |
} else { | |
chrome.storage.sync.set({ [key]: initialValue }, () => {}); | |
} | |
}); | |
return initialValue; |