chore(examples): removes all instances of React.forwardRef (#10334)

Similar to #10331. Since React 19, refs can now be passed directly
through props without the need for `React.forwardRef`. This greatly
simplifies components types and overall syntax.
This commit is contained in:
Jacob Fletcher
2025-01-03 13:10:46 -05:00
committed by GitHub
parent 47e8158d1e
commit 1f4790a314
16 changed files with 211 additions and 275 deletions

View File

@@ -1,6 +1,4 @@
import type { Ref } from 'react'
import React, { forwardRef } from 'react'
import React from 'react'
import classes from './index.module.scss'
@@ -8,12 +6,12 @@ type Props = {
children: React.ReactNode
className?: string
left?: boolean
ref?: Ref<HTMLDivElement>
ref?: React.Ref<HTMLDivElement>
right?: boolean
}
export const Gutter: React.FC<Props> = forwardRef<HTMLDivElement, Props>((props, ref) => {
const { children, className, left = true, right = true } = props
export const Gutter: React.FC<Props & { ref?: React.Ref<HTMLDivElement> }> = (props) => {
const { children, className, left = true, right = true, ref } = props
return (
<div
@@ -30,6 +28,4 @@ export const Gutter: React.FC<Props> = forwardRef<HTMLDivElement, Props>((props,
{children}
</div>
)
})
Gutter.displayName = 'Gutter'
}