How do I use a React ref in a decorator? #24716
Unanswered
hans-pragt
asked this question in
Help
Replies: 1 comment
-
I managed to do it with the render: (args) => {
const storybookRef = useRef<HTMLDivElement>(null)
return (
<>
<TestComponent {...args} parentRef={storybookRef} />
<AnotherComponentThatUseRef
parentRef={storybookRef}
/>
)
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! Say I have a custom decorator like so:
When I run this story, the browser console warns that:
Also, clicking the button shows that
testRef.current
isnull
.How do I use
ref
in a custom decorator?Beta Was this translation helpful? Give feedback.
All reactions