Skip to content

Commit 0ea7d99

Browse files
committed
Revert "Adopt bvaughn's example"
This reverts commit 2e1554d.
1 parent 2e1554d commit 0ea7d99

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

examples/16-3-release-blog-post/forward-ref-example.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,9 @@ function withTheme(Component) {
2020
// We can pass it along to ThemedComponent as a regular prop, e.g. "forwardedRef"
2121
// And it can then be attached to the Component.
2222
// highlight-range{1-3}
23-
function refForwarder(props, ref) {
24-
return (
25-
<ThemedComponent {...props} forwardedRef={ref} />
26-
);
27-
}
28-
29-
// These next lines are not necessary,
30-
// But they do give the component a better display name in DevTools,
31-
// e.g. "ForwardRef(withTheme(MyComponent))"
32-
// highlight-range{1-2}
33-
const name = Component.displayName || Component.name;
34-
refForwarder.displayName = `withTheme(${name})`;
35-
36-
// highlight-next-line
37-
return React.forwardRef(refForwarder);
23+
return React.forwardRef((props, ref) => (
24+
<ThemedComponent {...props} forwardedRef={ref} />
25+
));
3826
}
3927

4028
// highlight-next-line

0 commit comments

Comments
 (0)