Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: separate useControlledState hook #1267

Conversation

IsaevAlexandr
Copy link
Contributor

@GermanVor related to #1090 (comment).

I'm not sure if this functionality is needed or not. I make this proposal to discuss

amje and others added 30 commits December 6, 2023 14:41
@IsaevAlexandr IsaevAlexandr force-pushed the feature-separate-controlled-state-hook branch from 6638803 to 788c002 Compare January 22, 2024 15:50
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@GermanVor
Copy link
Contributor

also here

I think it's a simple hook that will be regularly used while developing library components

const [state, setState] = React.useState(value ?? defaultValue);

return [
value || state,
Copy link
Contributor

Choose a reason for hiding this comment

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

value ?? state

@GermanVor
Copy link
Contributor

GermanVor commented Jan 24, 2024

@IsaevAlexandr @amje @korvin89 Ping

@korvin89
Copy link
Contributor

@IsaevAlexandr Hey! We already have this one. Could we use your hook instead of date-components hook?

@amje
Copy link
Contributor

amje commented Jan 26, 2024

@IsaevAlexandr @korvin89 Seems the same functionality is implemented in #1276

@korvin89
Copy link
Contributor

This functionality have added here #1276

@korvin89 korvin89 closed this Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.