@@ -665,7 +665,7 @@ describe('ReactHooks', () => {
665665 return null ;
666666 }
667667 expect ( ( ) => ReactTestRenderer . create ( < App /> ) ) . toWarnDev (
668- 'Hooks can only be called inside the body of a function component ' ,
668+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' ,
669669 ) ;
670670 } ) ;
671671
@@ -835,12 +835,12 @@ describe('ReactHooks', () => {
835835 if ( __DEV__ ) {
836836 expect ( console . error ) . toHaveBeenCalledTimes ( 3 ) ;
837837 expect ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toContain (
838- 'Hooks can only be called inside the body of a function component ' ,
838+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks ' ,
839839 ) ;
840840 }
841841 } ) ;
842842
843- it ( "throws when calling hooks inside useState's initialize function" , ( ) => {
843+ it ( "warns when calling hooks inside useState's initialize function" , ( ) => {
844844 const { useState, useRef} = React ;
845845 function App ( ) {
846846 useState ( ( ) => {
@@ -850,7 +850,7 @@ describe('ReactHooks', () => {
850850 return null ;
851851 }
852852 expect ( ( ) => ReactTestRenderer . create ( < App /> ) ) . toWarnDev (
853- 'Hooks can only be called inside the body of a function component ' ,
853+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' ,
854854 ) ;
855855 } ) ;
856856
@@ -892,9 +892,9 @@ describe('ReactHooks', () => {
892892 } ) . toWarnDev ( [
893893 // We see it twice due to replay
894894 'Context can only be read while React is rendering' ,
895- 'Hooks can only be called inside the body of a function component ' ,
895+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks ' ,
896896 'Context can only be read while React is rendering' ,
897- 'Hooks can only be called inside the body of a function component ' ,
897+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks ' ,
898898 ] ) ;
899899
900900 function Valid ( ) {
@@ -925,9 +925,9 @@ describe('ReactHooks', () => {
925925 } ) . toWarnDev ( [
926926 // We see it twice due to replay
927927 'Context can only be read while React is rendering' ,
928- 'Hooks can only be called inside the body of a function component ' ,
928+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks ' ,
929929 'Context can only be read while React is rendering' ,
930- 'Hooks can only be called inside the body of a function component ' ,
930+ 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks ' ,
931931 ] ) ;
932932 } ) ;
933933
0 commit comments