Describe the bug
Doesn't work at all, elementRef never becomes assigned. But this is fully allowed by the type system and compiles
const MyComp = () =>
{
let elementRef: HTMLDivElement | undefined
return (
<div ref={[
elementRef
]}>
</div>
)
}
Works as intended
const MyComp = () =>
{
let elementRef: HTMLDivElement | undefined
return (
<div ref={[
el => elementRef = el
]}>
</div>
)
}
So I'm guessing either this is a bug or it simply shouldn't compile if it's not meant to be supported.
Your Example Website or App
See description
Steps to Reproduce the Bug or Issue
Just put a ref variable inside the ref array like ref={[myRef]} and it will never be assigned.
Expected behavior
Either a compile error if this isn't intended or the ref element to be successfully assigned
Screenshots or Videos
No response
Platform
- OS: [Windows]
- Browser: Chrome
- Version: [152]
Additional context
No response
Describe the bug
Doesn't work at all, elementRef never becomes assigned. But this is fully allowed by the type system and compiles
Works as intended
So I'm guessing either this is a bug or it simply shouldn't compile if it's not meant to be supported.
Your Example Website or App
See description
Steps to Reproduce the Bug or Issue
Just put a ref variable inside the ref array like ref={[myRef]} and it will never be assigned.
Expected behavior
Either a compile error if this isn't intended or the ref element to be successfully assigned
Screenshots or Videos
No response
Platform
Additional context
No response