Skip to content

fix: load script type errors #3405

New issue

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

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

Already on GitHub? # to your account

Merged

Conversation

pimjunhavittaya
Copy link

Please explain PR reason

Fix type errors related to React ref for React 19

@@ -237,7 +235,11 @@ class LoadScript extends PureComponent<LoadScriptProps, LoadScriptState> {
override render(): ReactNode {
return (
<>
<div ref={this.check} />
<div
ref={(el) => {
Copy link
Owner

Choose a reason for hiding this comment

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

please use useCallback for the ref function

Copy link
Author

Choose a reason for hiding this comment

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

@JustFly1984 ,
Cannot use useCallback inside a class component, but I refactored to follow the same pattern as in packages/react-google-maps-api/src/GoogleMap.tsx

Please review again, thank you.

Copy link
Owner

@JustFly1984 JustFly1984 left a comment

Choose a reason for hiding this comment

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

please use useCallaback for ref function

@JustFly1984 JustFly1984 merged commit 05fed65 into JustFly1984:upgrade Feb 11, 2025
@JustFly1984
Copy link
Owner

merged and released 2.20.6

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants