Skip to content

Commit

Permalink
Correct WrappedInstance example in React Apollo docs (#3925)
Browse files Browse the repository at this point in the history
- Resolve logic issue ( `component.saySomething()` should be `component.getWrappedInstance().saySomething()` )
- Introduce `wrappedInstance` constant for clarity
  • Loading branch information
shanonvl authored and hwillson committed Sep 18, 2018
1 parent dc3d87a commit 5f433f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/source/api/react-apollo.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,10 @@ class MyContainerComponent extends Component {
return (
<MyGraphQLComponent
ref={component => {
assert(component.getWrappedInstance() instanceof MyComponent);
const wrappedInstance = component.getWrappedInstance();
assert(wrappedInstance instanceof MyComponent);
// We can call methods on the component class instance.
component.saySomething();
wrappedInstance.saySomething();
}}
/>
);
Expand Down

0 comments on commit 5f433f6

Please sign in to comment.