-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Base][useButton] Allow useButton params to be completely optional #36922
[Base][useButton] Allow useButton params to be completely optional #36922
Conversation
Netlify deploy previewhttps://deploy-preview-36922--material-ui.netlify.app/ Bundle size report |
c2bdf6a
to
4cd72c9
Compare
@@ -20,7 +20,7 @@ import { EventHandlers } from '../utils/types'; | |||
* | |||
* - [useButton API](https://mui.com/base/api/use-button/) | |||
*/ | |||
export default function useButton(parameters: UseButtonParameters): UseButtonReturnValue { | |||
export default function useButton(parameters?: UseButtonParameters): UseButtonReturnValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it would be safer to specify it as:
export default function useButton(parameters?: UseButtonParameters): UseButtonReturnValue { | |
export default function useButton(parameters: UseButtonParameters = {}): UseButtonReturnValue { |
This way, parameters
will always be defined inside the body. Plus, it's shorter :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right ~ I totally overcomplicated this 😅
4cd72c9
to
726a06f
Compare
Closes #36879