mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
New hook for the pets
This commit is contained in:
parent
7b90987b29
commit
d2b2c363aa
1
src/hooks/pets/index.ts
Normal file
1
src/hooks/pets/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './usePets';
|
16
src/hooks/pets/usePets.ts
Normal file
16
src/hooks/pets/usePets.ts
Normal file
@ -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<number>) =>
|
||||
{
|
||||
setPetRespect(respects);
|
||||
}
|
||||
|
||||
return { petRespect, setPetRespect, changePetRespect };
|
||||
}
|
||||
|
||||
export const usePets = () => useBetween(usePetsState);
|
Loading…
Reference in New Issue
Block a user