Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

🏷️ [react-hooks] Introduce initializer function to useToggle #2734

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

emileber
Copy link
Contributor

@emileber emileber commented Mar 4, 2024

Description

useToggle is a convenience wrapper around useState, but it doesn't provide its initializer function in the types.

const {value, toggle} = useToggle(() => expensiveComputation());

@emileber emileber self-assigned this Mar 4, 2024
@emileber emileber requested a review from a team as a code owner March 4, 2024 22:26
@emileber emileber requested review from mateus and james-a-c March 4, 2024 22:26
Copy link

@james-a-c james-a-c left a comment

Choose a reason for hiding this comment

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

lgtm - thanks for adding this!

@emileber emileber force-pushed the emileber/react-hooks/use-toggle-initial-value branch from 6f3d7dd to d94070b Compare March 6, 2024 16:12
@emileber emileber merged commit a4eae7d into main Mar 6, 2024
9 checks passed
@emileber emileber deleted the emileber/react-hooks/use-toggle-initial-value branch March 6, 2024 19:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants