I'm trying to import a GeoJSON file to react-leaflet like below:
import * as bar from "./data/bar.geojson";
...
function Foo() {
return (
<Map center={[...]} zoom={...}>
<TileLayer
...
/>
<GeoJSON data={bar} />
</Map>
);
}
export default Foo;
I'm getting "Error: Invalid GeoJSON object." for calling <GeoJSON data={bar} />. I hardcoded the same GeoJSON data to this javascript file and it worked, so it must be the way of importing or handling the GeoJSON file that is causing a problem.
Does anyone have an idea of why I'm having an error? Thanks in advance!