I'm importing Popup from react-leaflet
import { Marker, Map, Popup, TileLayer, ZoomControl, GeoJSON, ScaleControl} from 'react-leaflet'
and trying to extend it
class NewPopup extends Popup {
onPopupOpen = ({ popup }: { popup: LeafletElement }) => {
if (popup === this.leafletElement) {
console.log("Here open");
this.onOpen()
}
}
onPopupClose = ({ popup }: { popup: LeafletElement }) => {
if (popup === this.leafletElement) {
console.log("Here close");
this.onClose()
}
}
}
This compiles fine, but when I run it in the browser I get the error "Super expression must either be null or a function, not object"
When I console.log the Popup object it looks like this
{$$typeof: Symbol(react.forward_ref), render: ƒ, apply: ƒ, bind: ƒ, call: ƒ, …}
Rather than a React component. Do I need to import it differently?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)