cedricdelpoux / cedricdelpoux/react-google-maps-loader

Cannot call a class as a function

Open
#17 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
52
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hello,

The below component throws error when react-google-maps-loader is upgraded to 4.0.0.
Could you provide some guidance pls.

`export class GoogleAddressInputWrapper extends React.Component {
// tslint:disable-next-line
private component: any;

constructor(props: IGoogleAddressInputProps) {
super(props);
this.component = GoogleMapsLoader(GoogleAddressInputComponent, {
libraries: ['places'],
key: props.googleApiKey
});
}

public render() {
if (this.component == null) {
return null;
}

return ;
}
}`

Error is:

`Cannot call a class as a function
TypeError: Cannot call a class as a function
at _classCallCheck (http://localhost:6006/static/preview.bundle.js:223503:99)
at GoogleMapsLoader (http://localhost:6006/static/preview.bundle.js:223518:5)
at new GoogleAddressInputWrapper (http://localhost:6006/static/preview.bundle.js:223473:108)
at constructClassInstance (http://localhost:6006/static/preview.bundle.js:73144:20)
at updateClassComponent (http://localhost:6006/static/preview.bundle.js:74679:9)
at beginWork (http://localhost:6006/static/preview.bundle.js:75325:16)
at performUnitOfWork (http://localhost:6006/static/preview.bundle.js:78157:16)
at workLoop (http://localhost:6006/static/preview.bundle.js:78186:26)
at renderRoot (http://localhost:6006/static/preview.bundle.js:78217:9)
at performWorkOnRoot (http://localhost:6006/static/preview.bundle.js:78792:24)
`

Thanks.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with react-google-maps-loader 4.0.0 using the shown GoogleAddressInputWrapper and inspect the GoogleMapsLoader call first. Compare the loader's expected usage with the component's invocation; done means the upgrade no longer raises "Cannot call a class as a function" and the supported usage is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.