File tree Expand file tree Collapse file tree
examples/16-3-release-blog-post Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments