@samitouri / QOS-React / commits / b772e0e26b

"functional component" -> "function component" in hooks error messages

Sebastian Markbåge committed Oct 9, 2018 at 02:20 UTC b772e0e26bd8f3062e23e9d831045a39072d0372
6 files changed +13 -13
packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js
+1 -1
@@ -145,7 +145,7 @@ describe('ReactDOMServerHooks', () => {
145
146 return render(<Counter />);
147 },
148 - 'Hooks can only be called inside the body of a functional component.',
148 + 'Hooks can only be called inside the body of a function component.',
149 );
150
151 itRenders('multiple times when an updater is called', async render => {
packages/react-dom/src/server/ReactPartialRendererHooks.js
+3 -3
@@ -50,7 +50,7 @@ const RE_RENDER_LIMIT = 25;
50 function resolveCurrentlyRenderingComponent(): Object {
51 invariant(
52 currentlyRenderingComponent !== null,
53 - 'Hooks can only be called inside the body of a functional component.',
53 + 'Hooks can only be called inside the body of a function component.',
54 );
55 return currentlyRenderingComponent;
56 }
@@ -105,7 +105,7 @@ export function finishHooks(
105 children: any,
106 refOrContext: any,
107 ): any {
108 - // This must be called after every functional component to prevent hooks from
108 + // This must be called after every function component to prevent hooks from
109 // being used in classes.
110
111 while (didScheduleRenderPhaseUpdate) {
@@ -321,7 +321,7 @@ function dispatchAction<S, A>(
321 lastRenderPhaseUpdate.next = update;
322 }
323 } else {
324 - // This means an update has happened after the functional component has
324 + // This means an update has happened after the function component has
325 // returned. On the server this is a no-op. In React Fiber, the update
326 // would be scheduled for a future render.
327 }
packages/react-reconciler/src/ReactFiberHooks.js
+3 -3
@@ -121,7 +121,7 @@ const RE_RENDER_LIMIT = 25;
121 function resolveCurrentlyRenderingFiber(): Fiber {
122 invariant(
123 currentlyRenderingFiber !== null,
124 - 'Hooks can only be called inside the body of a functional component.',
124 + 'Hooks can only be called inside the body of a function component.',
125 );
126 return currentlyRenderingFiber;
127 }
@@ -154,7 +154,7 @@ export function finishHooks(
154 children: any,
155 refOrContext: any,
156 ): any {
157 - // This must be called after every functional component to prevent hooks from
157 + // This must be called after every function component to prevent hooks from
158 // being used in classes.
159
160 while (didScheduleRenderPhaseUpdate) {
@@ -325,7 +325,7 @@ export function useContext<T>(
325 context: ReactContext<T>,
326 observedBits: void | number | boolean,
327 ): T {
328 - // Ensure we're in a functional component (class components support only the
328 + // Ensure we're in a function component (class components support only the
329 // .unstable_read() form)
330 resolveCurrentlyRenderingFiber();
331 return readContext(context, observedBits);
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
+3 -3
@@ -121,7 +121,7 @@ describe('ReactHooks', () => {
121 ReactNoop.render(<BadCounter />);
122
123 expect(() => ReactNoop.flush()).toThrow(
124 - 'Hooks can only be called inside the body of a functional component.',
124 + 'Hooks can only be called inside the body of a function component.',
125 );
126
127 // Confirm that a subsequent hook works properly.
@@ -144,7 +144,7 @@ describe('ReactHooks', () => {
144 }
145 ReactNoop.render(<Counter />);
146 expect(() => ReactNoop.flush()).toThrow(
147 - 'Hooks can only be called inside the body of a functional component.',
147 + 'Hooks can only be called inside the body of a function component.',
148 );
149
150 // Confirm that a subsequent hook works properly.
@@ -158,7 +158,7 @@ describe('ReactHooks', () => {
158
159 it('throws when called outside the render phase', () => {
160 expect(() => useState(0)).toThrow(
161 - 'Hooks can only be called inside the body of a functional component.',
161 + 'Hooks can only be called inside the body of a function component.',
162 );
163 });
164
packages/react-reconciler/src/__tests__/ReactNewContext-test.internal.js
+2 -2
@@ -48,7 +48,7 @@ describe('ReactNewContext', () => {
48 // a suite of tests for a given context consumer implementation.
49 sharedContextTests('Context.Consumer', Context => Context.Consumer);
50 sharedContextTests(
51 - 'useContext inside functional component',
51 + 'useContext inside function component',
52 Context =>
53 function Consumer(props) {
54 const observedBits = props.unstable_observedBits;
@@ -1342,7 +1342,7 @@ describe('ReactNewContext', () => {
1342 }
1343 ReactNoop.render(<Foo />);
1344 expect(ReactNoop.flush).toThrow(
1345 - 'Hooks can only be called inside the body of a functional component.',
1345 + 'Hooks can only be called inside the body of a function component.',
1346 );
1347 });
1348 });
packages/react/src/ReactHooks.js
+1 -1
@@ -16,7 +16,7 @@ function resolveDispatcher() {
16 const dispatcher = ReactCurrentOwner.currentDispatcher;
17 invariant(
18 dispatcher !== null,
19 - 'Hooks can only be called inside the body of a functional component.',
19 + 'Hooks can only be called inside the body of a function component.',
20 );
21 return dispatcher;
22 }