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

[Select] Simplify handleChange in SelectInput #36983

Closed
ulrichstark opened this issue Apr 24, 2023 · 2 comments · Fixed by #37040
Closed

[Select] Simplify handleChange in SelectInput #36983

ulrichstark opened this issue Apr 24, 2023 · 2 comments · Fixed by #37040
Assignees
Labels
component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material

Comments

@ulrichstark
Copy link
Contributor

This line

const index = childrenArray.map((child) => child.props.value).indexOf(event.target.value);

could be simplified to const child = childrenArray.find((child) => child.props.value === event.target.value); to avoid:

I can do the change.
Is it worth submitting a PR?

@zannager zannager added component: select This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 24, 2023
@michaldudak
Copy link
Member

Nice catch! Feel free to submit a PR.

@michaldudak michaldudak added package: material-ui Specific to @mui/material enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 26, 2023
@ulrichstark
Copy link
Contributor Author

Submitted @michaldudak

@ulrichstark ulrichstark changed the title Simplify handleChange in SelectInput [Select] Simplify handleChange in SelectInput Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants