Skip to content

Commit

Permalink
[NoSsr] Reduce bundle size (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Feb 4, 2025
1 parent f8ed96c commit fc6e224
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react/src/unstable-no-ssr/NoSsr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ function NoSsr(props: NoSsrProps): React.JSX.Element {
}
}, [defer]);

// We need the Fragment here to force react-docgen to recognise NoSsr as a component.
return <React.Fragment>{mountedState ? children : fallback}</React.Fragment>;
// TODO casting won't be needed at one point https://github.com/DefinitelyTyped/DefinitelyTyped/pull/65135
// We could replace React.JSX.Element with React.ReactNode.
// But first, we need to bump min typescript support to version to 5.1 and enough people to adopt the above change.
return (mountedState ? children : fallback) as React.JSX.Element;
}

NoSsr.propTypes /* remove-proptypes */ = {
Expand Down

0 comments on commit fc6e224

Please sign in to comment.