This component wraps a MapLibre Layer object. He manages its life cycle and is
responsible for adding/removing it to the map. For this reason this component
must be a descendant of RMap.
The id and the type props are readonly. This allows us to manage
reactivity on the same instance throughout its lifecycle. In some cases you'll have
to add a key prop to maintain this state. see below Error: RLayer id should not change.
Usage
Reactivity
Some props are reactives. Here is the complete list, it applies depending on whether or not the layer
has this prop in its options.
Be careful to define stable objects for layout, paint and filter props to avoid multiplying renderings.
Map layer events
With MapLibre we can listen to map events associated to specific layer. See MapLibre doc reference MapLayerEventType.
With MapLibre React Components, you define these listeners directly as props of your <RLayer />.
Error: RLayer id should not change.
When you have conditional renderers within your RMap component you will need to set the
prop key for your RLayer to help React maintain its association with the correct component.
Consider id prop for MapLibre mapping and key prop for React mapping. If you want to know
why see Tips: key vs id.
Reference
RLayer accept same props as Layer options plus beforeId. Check the MapLibre Layers reference page for details.