File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,13 @@ export function useEffect(
91
91
deps : Array < mixed > | void | null ,
92
92
) : void {
93
93
const dispatcher = resolveDispatcher ( ) ;
94
+
95
+ if ( __DEV__ && create == null ) {
96
+ console . warn (
97
+ 'React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?' ,
98
+ ) ;
99
+ }
100
+
94
101
return dispatcher . useEffect ( create , deps ) ;
95
102
}
96
103
@@ -99,6 +106,13 @@ export function useInsertionEffect(
99
106
deps : Array < mixed > | void | null ,
100
107
) : void {
101
108
const dispatcher = resolveDispatcher ( ) ;
109
+
110
+ if ( __DEV__ && create == null ) {
111
+ console . warn (
112
+ 'React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?' ,
113
+ ) ;
114
+ }
115
+
102
116
return dispatcher . useInsertionEffect ( create , deps ) ;
103
117
}
104
118
@@ -107,6 +121,13 @@ export function useLayoutEffect(
107
121
deps : Array < mixed > | void | null ,
108
122
) : void {
109
123
const dispatcher = resolveDispatcher ( ) ;
124
+
125
+ if ( __DEV__ && create == null ) {
126
+ console . warn (
127
+ 'React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?' ,
128
+ ) ;
129
+ }
130
+
110
131
return dispatcher . useLayoutEffect ( create , deps ) ;
111
132
}
112
133
You can’t perform that action at this time.
0 commit comments