-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
Description
Description
This issue is based on this Discord report
The error that happens when using Portal with Next.js 13.0.5
Warning: Portal: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
The root of the problem:
Portal.defaultProps = { |
Links to React PR and ESLint change:
facebook/react#25699
jsx-eslint/eslint-plugin-react#2396
Other components might also be affected.
Problem Statement/Justification
This will make Chakra UI more aligned with React 18.3.0
Proposed Solution or API
Change:
Portal.defaultProps = {
appendToParentPortal: true,
}
Into:
export function Portal(props: PortalProps) {
const { containerRef, ...rest } = { appendToParentPortal: true, ...props };
return containerRef ? (
<ContainerPortal containerRef={containerRef} {...rest} />
) : (
<DefaultPortal {...rest} />
)
}
The goal isn't to remove defaultProps
, but to change how they're defined on function components.
Alternatives
No response
Additional Information
No response
DavidSanek, AlexKvazos, sawa-ko, hhhhailey, elijahmurray and 2 more