Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {useEffect, useState} from 'react';

/**
* @returns {Array}
*/
export default function useThrottledButtonState() {
type ThrottledButtonState = [boolean, () => void];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type ThrottledButtonState = [boolean, () => void];
type ThrottledButtonState = [boolean, Dispatch<SetStateAction<boolean>>];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kubabutkiewicz when I apply your suggestion, I'm getting this tooltip:

image

Which is expecting a boolean value to be passed to that function. In reality though, this function doesn't accept any params. LMK your thoughts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I thought we are returning the state setter from this hook but we are returning function which is just setting state to false so nvm. LGTM


export default function useThrottledButtonState(): ThrottledButtonState {
const [isButtonActive, setIsButtonActive] = useState(true);

useEffect(() => {
Expand Down