rlayers
rlayers copied to clipboard
Generating RLayerVector objects outside of RMap
Hello, I am using this library in a React app where I am required to create components outside of my the RMap object. Is there any way, using RContext maybe, to generate RLayerVector objects outside of RMap and pass them in as children using the spread operator?
Currently, an RLayerVector
does not support being detached and reattached to another RMap
- this is the missing feature
I think you need useRef for each RLayerVector in parent component, i'm working on that also, but the problem is when using RControl.Rlayer and you put RLayerVector inside or outside there with custom event handler yourself it's not work, I have code like this.
on parent component
const vector1 = useRef()
<RMap>
<RLayerVector vector1Ref={vector1}/>
</RMap>
and then on your child component define ref on RLayerVector, and also mostly you can see that ref console.log(props.vector1Ref)