Open dagatsoin opened 3 years ago
@dagatsoin -- I may be wrong here, but I believe the last really significant release of ReactXP was before React's MutableRef/ForwardRef APIs were super common place.
I've been unexpectedly swamped with unrelated stuff since September, but we have been hoping to get a turn of the crank on things.
Upgrading ReactXP to support modern Refs seems like a necessary upgrade! -- I'm putting it on the High Priority list, but I don't have a big sense of how much effort this change will require!
Any thoughts?
It could be easy if it is due to an old code base. I got a quick look and I don't see any code which handle the Ref attribute.
But here, the union type misses MutableObject
Nice catch! -- In this thread ( https://github.com/microsoft/reactxp/issues/1128#issuecomment-662658713 ) we agreed that the next major release for ReactXP should upgrade to React 16.3 or later!
Based on the comment by your line, maybe we should remove the private replication of the Ref API and instead just expose the one from React?
As you speculated, the current ReactXP implementation predates the introduction of MutableObject. I think it should be relatively straightforward to add support for it. The core ReactXP implementation uses the more traditional ref callbacks in places, but TMK that mechanism is still supported by newer versions of React, so there's no need to replace them.
Current behavior:
Passing a MutableRef to a Button rises an error.
Error received
Impact
1- Can't use the React.useRef hook 2- Can't use React.forwardRef
Workaround
Wrap the component and use a callback to transform the mutable ref in a callback.