Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to createContext in react-leaflet/es/context.js fails

TypeError: Object(...) is not a function

./node_modules/react-leaflet/es/context.js node_modules/react-leaflet/es/context.js:8

// $FlowFixMe: import
forwardRef } from 'react';

var _createContext = createContext({}), // This line fails
    Consumer = _createContext.Consumer,
    Provider = _createContext.Provider;
like image 625
katliam1999 Avatar asked Jun 01 '26 12:06

katliam1999


1 Answers

Just ran into this, you need to upgrade to React 16.3 or above as react-leaflet is using the context API.

npm i -S react react-dom

That should do it.

like image 167
rjerue Avatar answered Jun 04 '26 02:06

rjerue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!