mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
feat: add forwardRef into resetComponents
This commit is contained in:
parent
16d46edf76
commit
c9b51f2428
@ -1,4 +1,4 @@
|
||||
import { createElement, ElementType } from 'react';
|
||||
import { createElement, forwardRef, ElementType } from 'react';
|
||||
import { components as rawComponents } from './typography/DocumentFormatting';
|
||||
|
||||
export { Badge } from './Badge/Badge';
|
||||
@ -56,7 +56,7 @@ export { rawComponents as components };
|
||||
const resetComponents: Record<string, ElementType> = {};
|
||||
|
||||
Object.keys(rawComponents).forEach((key) => {
|
||||
resetComponents[key] = (props: any) => createElement(key, props);
|
||||
resetComponents[key] = forwardRef((props, ref) => createElement(key, { ...props, ref }));
|
||||
});
|
||||
|
||||
export { resetComponents };
|
||||
|
Loading…
x
Reference in New Issue
Block a user