mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
cleanup(phone/photos): Added type safety to photo state
This commit is contained in:
1 parent
d363866a34
commit
8b746c8185
2 files changed
+5
-9
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { atom } from 'recoil';
|
||||
import { IPhoto } from '../../../../../typings/photo';
|
||||
|
||||
export const photoState = {
|
||||
photos: atom({
|
||||
photos: atom<IPhoto[]>({
|
||||
key: 'galleryPhotos',
|
||||
default: null,
|
||||
default: [],
|
||||
}),
|
||||
};
|
||||
@@ -1,11 +1,6 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export interface ICameraPhoto {
|
||||
id: string;
|
||||
image: string;
|
||||
}
|
||||
|
||||
export const usePhotos = (): ICameraPhoto[] | null => {
|
||||
return useRecoilValue<ICameraPhoto[] | null>(photoState.photos);
|
||||
export const usePhotos = () => {
|
||||
return useRecoilValue(photoState.photos);
|
||||
};
|
||||
Reference in new issue
Block a user