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(
9191 deps : Array < mixed > | void | null ,
9292) : void {
9393 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+
94101 return dispatcher . useEffect ( create , deps ) ;
95102}
96103
@@ -99,6 +106,13 @@ export function useInsertionEffect(
99106 deps : Array < mixed > | void | null ,
100107) : void {
101108 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+
102116 return dispatcher . useInsertionEffect ( create , deps ) ;
103117}
104118
@@ -107,6 +121,13 @@ export function useLayoutEffect(
107121 deps : Array < mixed > | void | null ,
108122) : void {
109123 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+
110131 return dispatcher . useLayoutEffect ( create , deps ) ;
111132}
112133
You can’t perform that action at this time.
0 commit comments