Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Revert "Adopt bvaughn's example"
Browse files Browse the repository at this point in the history
This reverts commit 2e1554d.
  • Loading branch information
koba04 committed Apr 2, 2018
1 parent 2e1554d commit 0ea7d99
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions examples/16-3-release-blog-post/forward-ref-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,9 @@ function withTheme(Component) {
// We can pass it along to ThemedComponent as a regular prop, e.g. "forwardedRef"
// And it can then be attached to the Component.
// highlight-range{1-3}
function refForwarder(props, ref) {
return (
<ThemedComponent {...props} forwardedRef={ref} />
);
}

// These next lines are not necessary,
// But they do give the component a better display name in DevTools,
// e.g. "ForwardRef(withTheme(MyComponent))"
// highlight-range{1-2}
const name = Component.displayName || Component.name;
refForwarder.displayName = `withTheme(${name})`;

// highlight-next-line
return React.forwardRef(refForwarder);
return React.forwardRef((props, ref) => (
<ThemedComponent {...props} forwardedRef={ref} />
));
}

// highlight-next-line
Expand Down

0 comments on commit 0ea7d99

Please sign in to comment.