enzyme icon indicating copy to clipboard operation
enzyme copied to clipboard

Fix ref on root component pointing to internal component

Open eps1lon opened this issue 5 years ago • 1 comments

When using mount(<div ref={React.createRef()} />) ref.current was pointing to an internal wrapper component.

Previous workarounds:

  1. mount(<><div ref={React.createRef()} /></>)
  2. mount(<div />).instance()

Both workarounds require knowledge of either enzymes API (2) or internals (1). Making this just™ work should be preferred IMO.

eps1lon avatar Apr 16 '19 14:04 eps1lon

When I opened this I didn't realize how many moving parts are involved for this. Since this already has two workarounds I'm not that motivated to spend more hours on this fix.

Since I won't work on this I'm closing for now. Feel free to reopen and finish the work required to get this merged.

eps1lon avatar May 11 '19 11:05 eps1lon