chore(widgets) cleanup widget constructors#9312
Conversation
| props.label = props.label || 'Compass'; | ||
| props.style = props.style || {}; | ||
| this.props = props; | ||
| this.id = props.id ?? this.id; |
There was a problem hiding this comment.
How much do we gain by copying these over to field rather than just accessing them from this.props? Seems like a bunch of boilerplate code for widgets that might not be necessary.
There was a problem hiding this comment.
Maybe one line of boilerplate would be saved since id is the only required member.
The projected widgets like Tooltip or Marker don't expose the placement member as a props since they're always in "fill".
I see the duplicate code. Maybe an abstract class could help?
There was a problem hiding this comment.
I don't think the case for an abstract class is quite black and white, at least not until the amount of shared code grows further.
I agree that having all code visible and not relying on base class magic is also valuable.
For #9056
Background
Pulling non-react changes out of #9278
Change List