From 38acea4d4b60af4fe747da0b282ece4c073dfde7 Mon Sep 17 00:00:00 2001 From: Rob Richard Date: Tue, 9 Jan 2018 19:14:52 -0500 Subject: [PATCH] [Docs] Provide migration instructions for `ref(refName)` --- docs/guides/migration-from-2-to-3.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/guides/migration-from-2-to-3.md b/docs/guides/migration-from-2-to-3.md index 30fee1865..63d0377c0 100644 --- a/docs/guides/migration-from-2-to-3.md +++ b/docs/guides/migration-from-2-to-3.md @@ -391,6 +391,11 @@ expect(wrapper.ref('abc')).toBeInstanceOf(Box); In our experience, this is most often what people would actually want and expect out of the `.ref(...)` method. +To get the wrapper that was returned by enzyme 2: +```js +const wrapper = mount(); +const refWrapper = wrapper.findWhere(n => n.instance() === wrapper.ref('abc')); +``` ## With `mount`, `.instance()` can be called at any level of the tree