From f03962731d5616400b1621a567be29699f873120 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Thu, 24 Jan 2019 04:37:56 +0000 Subject: [PATCH 1/3] point to warning page on docs --- packages/react/src/ReactHooks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react/src/ReactHooks.js b/packages/react/src/ReactHooks.js index 37f85cd5c35..d53d34981aa 100644 --- a/packages/react/src/ReactHooks.js +++ b/packages/react/src/ReactHooks.js @@ -17,7 +17,8 @@ function resolveDispatcher() { const dispatcher = ReactCurrentDispatcher.current; invariant( dispatcher !== null, - 'Hooks can only be called inside the body of a function component.', + 'Hooks can only be called inside the body of a function component.' + + 'See https://fb.me/react-hooks-in-function-components for more information', ); return dispatcher; } From e19903855be882e3735341a13ac99eec304f4b90 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Thu, 24 Jan 2019 13:20:56 +0000 Subject: [PATCH 2/3] whitespace --- packages/react/src/ReactHooks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/ReactHooks.js b/packages/react/src/ReactHooks.js index d53d34981aa..624a7833b0b 100644 --- a/packages/react/src/ReactHooks.js +++ b/packages/react/src/ReactHooks.js @@ -17,7 +17,7 @@ function resolveDispatcher() { const dispatcher = ReactCurrentDispatcher.current; invariant( dispatcher !== null, - 'Hooks can only be called inside the body of a function component.' + + 'Hooks can only be called inside the body of a function component. ' + 'See https://fb.me/react-hooks-in-function-components for more information', ); return dispatcher; From ef0bd6997fa19682394e8bb047b5e597280485fd Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Thu, 24 Jan 2019 13:23:53 +0000 Subject: [PATCH 3/3] all the places --- packages/react-dom/src/server/ReactPartialRendererHooks.js | 3 ++- packages/react-reconciler/src/ReactFiberHooks.js | 3 ++- packages/react-test-renderer/src/ReactShallowRenderer.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/react-dom/src/server/ReactPartialRendererHooks.js b/packages/react-dom/src/server/ReactPartialRendererHooks.js index d8496b8a262..739effcfc8a 100644 --- a/packages/react-dom/src/server/ReactPartialRendererHooks.js +++ b/packages/react-dom/src/server/ReactPartialRendererHooks.js @@ -55,7 +55,8 @@ let currentHookNameInDev: ?string; function resolveCurrentlyRenderingComponent(): Object { invariant( currentlyRenderingComponent !== null, - 'Hooks can only be called inside the body of a function component.', + 'Hooks can only be called inside the body of a function component. ' + + 'See https://fb.me/react-hooks-in-function-components for more information', ); return currentlyRenderingComponent; } diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 00cd8aa9403..d127c8062a7 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -151,7 +151,8 @@ let currentHookNameInDev: ?HookType = null; function resolveCurrentlyRenderingFiber(): Fiber { invariant( currentlyRenderingFiber !== null, - 'Hooks can only be called inside the body of a function component.', + 'Hooks can only be called inside the body of a function component. ' + + 'See https://fb.me/react-hooks-in-function-components for more information', ); return currentlyRenderingFiber; } diff --git a/packages/react-test-renderer/src/ReactShallowRenderer.js b/packages/react-test-renderer/src/ReactShallowRenderer.js index 815220efb7c..4274387927a 100644 --- a/packages/react-test-renderer/src/ReactShallowRenderer.js +++ b/packages/react-test-renderer/src/ReactShallowRenderer.js @@ -218,7 +218,8 @@ class ReactShallowRenderer { _validateCurrentlyRenderingComponent() { invariant( this._currentlyRenderingComponent !== null, - 'Hooks can only be called inside the body of a function component.', + 'Hooks can only be called inside the body of a function component.' + + 'See https://fb.me/react-hooks-in-function-components for more information', ); }