Skip to content

Commit 38acea4

Browse files
robrichardljharb
authored andcommitted
[Docs] Provide migration instructions for ref(refName)
1 parent 7869527 commit 38acea4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/guides/migration-from-2-to-3.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ expect(wrapper.ref('abc')).toBeInstanceOf(Box);
391391
In our experience, this is most often what people would actually want and expect out of the `.ref(...)`
392392
method.
393393

394+
To get the wrapper that was returned by enzyme 2:
395+
```js
396+
const wrapper = mount(<Bar />);
397+
const refWrapper = wrapper.findWhere(n => n.instance() === wrapper.ref('abc'));
398+
```
394399

395400
## With `mount`, `.instance()` can be called at any level of the tree
396401

0 commit comments

Comments
 (0)