Giter Site home page Giter Site logo

Comments (3)

slutske22 avatar slutske22 commented on May 29, 2024

Wow I guess I never tested the refs before. You're right, this is a problem. I need to wrap the underlying EsriLeafletLayer in a forwardRef call to get this working, or make it a class component. I'll try to fix this as soon as I can. Currently, a crappy workaround is to do this:

import { EsriLeafletLayer } from "react-esri-leaflet";

const Map = () => {
  var dynamicMapLayerRef = React.useRef();

  return (
    <MapContainer ... >=
      <EsriLeafletLayer
        layerType="dynamicMapLayer"
        ref={dynamicMapLayerRef}
        url="your_layer_url"
      />
    </MapContainer>
  );
};

Here's a working example of that. Right this moment it seems that dynamic map layer url is not working on the arcgis side, but the ref to the layer is still working.

I'll get working on fixing this for real hopefully within the next few days.

from react-esri-leaflet.

slutske22 avatar slutske22 commented on May 29, 2024

This is fixed now. Upgrade to 1.3.0 and you should be able to use refs normally as described in the docs. The examples also now have working examples of using refs (check out the <FeatureLayer /> component in either example folder). Let me know if you have any more issues with this.

from react-esri-leaflet.

kevinkdarling avatar kevinkdarling commented on May 29, 2024

Just wanted to thank you very much for the fix! You saved our project.

from react-esri-leaflet.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.