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

Antd Select issue on ref using HTMLSelectElement #41273

Closed
tempoeric opened this issue Mar 16, 2023 · 5 comments
Closed

Antd Select issue on ref using HTMLSelectElement #41273

tempoeric opened this issue Mar 16, 2023 · 5 comments

Comments

@tempoeric
Copy link
Contributor

Reproduction link

https://e8fm9c.csb.app/

Steps to reproduce

Click the link and check the code should be able to add ref as HTMLSelectElement

What is expected?

should have no error adding ref as HTMLSelectElement

What is actually happening?

error when adding ref as HTMLSelectElement

Environment Info
antd 5.2.1
React 18.2.0
System Mac OS Ventura 13.1
Browser Google Chrome
@github-actions
Copy link
Contributor

@tempoeric
Copy link
Contributor Author

@afc163 @MadCcc please check

@afc163
Copy link
Member

afc163 commented Mar 16, 2023

Select don't contain native select element in it, so I don't think type of Select ref should be a HTMLSelectElement.

@afc163 afc163 closed this as completed Mar 16, 2023
@tempoeric
Copy link
Contributor Author

tempoeric commented Mar 16, 2023

so what ref should i use atleast give me a selectprops as ref or something

@tempoeric
Copy link
Contributor Author

cause im having issue without ref in select

Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants