Skip to content

Commit 3d26657

Browse files
refactor: inline the other create == null checks
1 parent 45e4ca4 commit 3d26657

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

packages/react/src/ReactHooks.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function useEffect(
9393
updateDeps?: Array<mixed> | void | null,
9494
destroy?: ((resource: {...} | void | null) => void) | void,
9595
): void {
96-
if (__DEV__ ) {
96+
if (__DEV__) {
9797
if (create == null) {
9898
console.warn(
9999
'React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?',
@@ -126,10 +126,12 @@ export function useInsertionEffect(
126126
create: () => (() => void) | void,
127127
deps: Array<mixed> | void | null,
128128
): void {
129-
if (__DEV__ && create == null) {
130-
console.warn(
131-
'React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?',
132-
);
129+
if (__DEV__) {
130+
if (create == null) {
131+
console.warn(
132+
'React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?',
133+
);
134+
}
133135
}
134136

135137
const dispatcher = resolveDispatcher();
@@ -140,10 +142,12 @@ export function useLayoutEffect(
140142
create: () => (() => void) | void,
141143
deps: Array<mixed> | void | null,
142144
): void {
143-
if (__DEV__ && create == null) {
144-
console.warn(
145-
'React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?',
146-
);
145+
if (__DEV__) {
146+
if (create == null) {
147+
console.warn(
148+
'React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?',
149+
);
150+
}
147151
}
148152

149153
const dispatcher = resolveDispatcher();

0 commit comments

Comments
 (0)