mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-02-01 16:46:24 +00:00
Clarify ref migration in upgrade guide (#1356)
This commit is contained in:
parent
59d7f7379a
commit
c5501f56b3
@ -16,6 +16,10 @@ const CONTROLLER_OPTS = {
|
|||||||
<MapGL {...CONTROLLER_OPTS} ... />
|
<MapGL {...CONTROLLER_OPTS} ... />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `Source` and `Layer` components no longer expose imperative methods via `ref` as part of the migration to functional components. This is to comply with the pattern recommended by the latest React.
|
||||||
|
+ If you used to call `sourceRef.getSource()`, it can be replaced with `mapRef().getMap().getSource(sourceId)`.
|
||||||
|
+ If you used to call `layerRef.getLayer()`, it can be replaced with `mapRef().getMap().getLayer(layerId)`.
|
||||||
|
|
||||||
## Upgrading to v6
|
## Upgrading to v6
|
||||||
|
|
||||||
- A valid Mapbox access token is always required.
|
- A valid Mapbox access token is always required.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user