-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
React 19 removes support for defaultProps
on function components in favor of ES6 default parameters. As stated in the React 19 Upgrade Guide:
We're also removing
defaultProps
from function components in place of ES6 default parameters. Class components will continue to supportdefaultProps
since there is no ES6 alternative.
Blueprint currently has two functional components that use the deprecated defaultProps
object: DateInput
and Overlay2
blueprint/packages/datetime/src/components/date-input/dateInput.tsx
Lines 567 to 569 in 7668fd2
// TODO: Removing `defaultProps` here breaks tests. Investigate why. | |
// eslint-disable-next-line @typescript-eslint/no-deprecated | |
DateInput.defaultProps = DATEINPUT_DEFAULT_PROPS; |
blueprint/packages/core/src/components/overlay2/overlay2.tsx
Lines 657 to 658 in 7668fd2
// eslint-disable-next-line @typescript-eslint/no-deprecated | |
Overlay2.defaultProps = OVERLAY2_DEFAULT_PROPS; |
We will remove defaultProps
from these components and replace with ES6 default parameters. The following PRs capture this:
- [DateInput]: Remove
defaultProps
and consolidate datetime constants #7516 - [Overlay2]: Remove
defaultProps
from component #7517
Additionally, in the future when refactoring class components to function components, any instances of static defaultProps
should also be replaced with ES6 default parameters.