Refactor:upgrade react19 ref as props (#25225)
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import type { ComponentProps, FC, ReactNode } from 'react'
|
||||
import { forwardRef } from 'react'
|
||||
import classNames from '@/utils/classnames'
|
||||
|
||||
export type PreviewContainerProps = ComponentProps<'div'> & {
|
||||
header: ReactNode
|
||||
mainClassName?: string
|
||||
ref?: React.Ref<HTMLDivElement>
|
||||
}
|
||||
|
||||
export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, ref) => {
|
||||
const { children, className, header, mainClassName, ...rest } = props
|
||||
export const PreviewContainer: FC<PreviewContainerProps> = (props) => {
|
||||
const { children, className, header, mainClassName, ref, ...rest } = props
|
||||
return <div className={className}>
|
||||
<div
|
||||
{...rest}
|
||||
@@ -25,5 +25,5 @@ export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, re
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
})
|
||||
}
|
||||
PreviewContainer.displayName = 'PreviewContainer'
|
||||
|
Reference in New Issue
Block a user