With RLayer used as RSource child each button click causes App to rerender.
Even if the props of RSource have not changed, the RSourcechildren prop will have changed, which will cause an unnecessary re-rendering of RSource
With RSource declared outside RLayer each button click causes App to rerender.
In this case the props of RSource have not changed, which will not cause an unnecessary re-rendering of RSource.
Error: id should not change. key vs id
When you have conditional renderers within your RMap component you will need to set the prop key for your RSource to help React maintain its association with the correct component.
Consider id prop for MapLibre mapping and key prop for React mapping.
key vs id
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 for maplibre mapping and key for React mapping.
Note: if maplibre-react-components detects a mapping error it will throw an exception.