From d2b2c363aa49d9922d58dd0acf07eadcf5308e87 Mon Sep 17 00:00:00 2001 From: object Date: Wed, 10 Aug 2022 16:32:13 +0000 Subject: [PATCH] New hook for the pets --- src/hooks/pets/index.ts | 1 + src/hooks/pets/usePets.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/hooks/pets/index.ts create mode 100644 src/hooks/pets/usePets.ts diff --git a/src/hooks/pets/index.ts b/src/hooks/pets/index.ts new file mode 100644 index 00000000..055b581e --- /dev/null +++ b/src/hooks/pets/index.ts @@ -0,0 +1 @@ +export * from './usePets'; diff --git a/src/hooks/pets/usePets.ts b/src/hooks/pets/usePets.ts new file mode 100644 index 00000000..6453458e --- /dev/null +++ b/src/hooks/pets/usePets.ts @@ -0,0 +1,16 @@ +import { useState } from 'react'; +import { useBetween } from 'use-between'; + +const usePetsState = () => +{ + const [ petRespect, setPetRespect ] = useState(0); + + const changePetRespect = (respects: React.SetStateAction) => + { + setPetRespect(respects); + } + + return { petRespect, setPetRespect, changePetRespect }; +} + +export const usePets = () => useBetween(usePetsState);