visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

[Feat] Change "defaultProps" strategy in components to "JavaScript default parameters" #2117

Closed luanmm closed 1 year ago

luanmm commented 1 year ago

Target Use Case

Anticipate to deprecated functionality removal (and avoid error/warning messages in console).

Proposal

As it is stated in React DOM warnings:

Warning: ScaleControl: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Components should be using JavaScript default parameters as an alternative.

elewin commented 1 year ago

I am getting this on Marker as well:

Warning: Marker: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead

This is using react-map-gl 7.0.25

luanmm commented 1 year ago

Looking in v7.0.25 tag, seems that PR #2173 is not present in code. Don't know why exactly, as it appears to be merged. So it should keep giving warnings, indeed, until a release with this change.

Pessimistress commented 1 year ago

This will be landed in v7.1.