This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState } from "react"; | |
| /** | |
| * useDebounce hook | |
| * This hook allows you to debounce any fast changing value. The debounced value will only | |
| * reflect the latest value when the useDebounce hook has not been called for the specified delay period. | |
| * | |
| * @param value - The value to be debounced. | |
| * @param delay - The delay in milliseconds for the debounce. | |
| * @returns The debounced value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Custom hook for dynamically resizing a textarea to fit its content. | |
| * @param {React.RefObject<HTMLTextAreaElement>} textareaRef - Reference to the textarea element. | |
| * @param {string} textContent - Current text content of the textarea. | |
| * @param {number} maxHeight - Optional: maxHeight of the textarea in pixels. | |
| */ | |
| import { useEffect } from "react"; | |
| const useDynamicTextareaSize = ( | |
| textareaRef: React.RefObject<HTMLTextAreaElement>, |
NewerOlder