use-calendar-data
v0.1.0
Published
The `use-calendar-data` is a reusable hook for managing all the state related logic for your calendar component. The Calendar Component link is given below:
Downloads
1
Readme
The use-calendar-data
is a reusable hook for managing all the state related logic for your calendar component. The Calendar Component link is given below:
Table of Contents:
1- Installation.
2- Usage.
Installation:
Run the following command to install the package:
npm i use-calendar-data
Now import it in the file you wanna use the hook using import useCalendarData from 'use-calendar-data'
.
Usage:
As the purpose of this hook is to provide user with the methods that handles the logic related to setting and returning of dates. You can get the states and the functions using:
const {
duration,
handleDurationChange,
selectedDate,
handleSelectDate,
selectedTime,
handleSelectTime,
} = useCarouselData(onDateChange, onTimeChange, timeFormat, onDurationChange);
Note that other than the callback values:
- onDateChange
- onTimeChange
- onDurationChange
There is a timeFormat to be passed which is in string. And all these values are supposed to be passed by the user.