Use Jotai instead of React Context #65

Merged
DrMint merged 6 commits from jotai into main 2022-11-04 01:30:20 +00:00
3 changed files with 4 additions and 4 deletions
Showing only changes of commit 1e2b0c25f5 - Show all commits

View File

@ -6,7 +6,7 @@ import { LightBox } from "components/LightBox";
import { filterDefined } from "helpers/others";
import { atomPairing, useAtomSetter } from "helpers/atoms";
export const lightBoxAtom = atomPairing(
const lightBoxAtom = atomPairing(
atom<{
showLightBox: (
images: (UploadImageFragment | string | null | undefined)[],
@ -15,7 +15,7 @@ export const lightBoxAtom = atomPairing(
}>({ showLightBox: () => null })
);
export const lightBox = lightBoxAtom[0]
export const lightBox = lightBoxAtom[0];
export const LightBoxProvider = (): JSX.Element => {
const [isLightBoxVisible, setLightBoxVisibility] = useState(false);

View File

@ -6,7 +6,7 @@ import { atomPairing } from "helpers/atoms";
import { settings } from "contexts/settings";
import { lightBox } from "contexts/LightBoxProvider";
/*
/*
* I'm getting a weird error if I put those atoms in appLayout.ts
* So I'm putting the atoms here. Sucks, I know.
*/

View File

@ -1,6 +1,6 @@
import { atom } from "jotai";
import { useRouter } from "next/router";
import React, { useEffect } from "react";
import { useEffect } from "react";
import { useFetch } from "usehooks-ts";
import { atomPairing, useAtomSetter } from "helpers/atoms";
import {