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

[core] Enforce hook parameters to use required values #856

Open
atomiks opened this issue Nov 22, 2024 · 2 comments
Open

[core] Enforce hook parameters to use required values #856

atomiks opened this issue Nov 22, 2024 · 2 comments
Labels
core Infrastructure work going on behind the scenes

Comments

@atomiks
Copy link
Contributor

atomiks commented Nov 22, 2024

Hooks aren't public APIs and don't need optional values. This change will ensure all component props that are needed by the hook are forwarded correctly to prevent bugs. Components should be responsible for defining default values in their props which are then forwarded to the hook.

Search keywords:

@mj12albert
Copy link
Member

#889 (comment)

Can we set it to undefined so that it makes sense among other prop types?

image

Do we need to make an exception for optional event handlers to avoid exposing "NOOP" like this? @atomiks

@atomiks
Copy link
Contributor Author

atomiks commented Dec 2, 2024

@mj12albert I suppose you can do onEvent: onEventProp || NOOP when passing it to the hook instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

No branches or pull requests

2 participants