File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
react-devtools-shared/src/__tests__
react-devtools-shell/src/app/ElementTypes Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -856,6 +856,13 @@ describe('Store', () => {
856
856
857
857
const MyComponent = ( props , ref ) => null ;
858
858
const FowardRefComponent = React . forwardRef ( MyComponent ) ;
859
+ const FowardRefComponentWithAnonymousFunction = React . forwardRef ( ( ) => (
860
+ < MyComponent />
861
+ ) ) ;
862
+ const FowardRefComponentWithCustomDisplayName = React . forwardRef (
863
+ MyComponent ,
864
+ ) ;
865
+ FowardRefComponentWithCustomDisplayName . displayName = 'Custom' ;
859
866
const MemoComponent = React . memo ( MyComponent ) ;
860
867
const MemoForwardRefComponent = React . memo ( FowardRefComponent ) ;
861
868
const LazyComponent = React . lazy ( ( ) => fakeImport ( MyComponent ) ) ;
@@ -864,6 +871,8 @@ describe('Store', () => {
864
871
< React . Fragment >
865
872
< MyComponent />
866
873
< FowardRefComponent />
874
+ < FowardRefComponentWithAnonymousFunction />
875
+ < FowardRefComponentWithCustomDisplayName />
867
876
< MemoComponent />
868
877
< MemoForwardRefComponent />
869
878
< React . Suspense fallback = "Loading..." >
Original file line number Diff line number Diff line change @@ -35,9 +35,16 @@ function FunctionComponent() {
35
35
36
36
const MemoFunctionComponent = memo ( FunctionComponent ) ;
37
37
38
- const ForwardRefComponent = forwardRef ( ( props , ref ) => (
38
+ const FowardRefComponentWithAnonymousFunction = forwardRef ( ( props , ref ) => (
39
39
< ClassComponent ref = { ref } { ...props } />
40
40
) ) ;
41
+ const ForwardRefComponent = forwardRef ( function NamedInnerFunction ( props , ref ) {
42
+ return < ClassComponent ref = { ref } { ...props } /> ;
43
+ } ) ;
44
+ const FowardRefComponentWithCustomDisplayName = forwardRef ( ( props , ref ) => (
45
+ < ClassComponent ref = { ref } { ...props } />
46
+ ) ) ;
47
+ FowardRefComponentWithCustomDisplayName . displayName = 'Custom' ;
41
48
42
49
const LazyComponent = lazy ( ( ) =>
43
50
Promise . resolve ( {
@@ -58,6 +65,8 @@ export default function ElementTypes() {
58
65
< FunctionComponent />
59
66
< MemoFunctionComponent />
60
67
< ForwardRefComponent />
68
+ < FowardRefComponentWithAnonymousFunction />
69
+ < FowardRefComponentWithCustomDisplayName />
61
70
< LazyComponent />
62
71
</ Suspense >
63
72
</ StrictMode >
You can’t perform that action at this time.
0 commit comments