Repository: facebook/react
File: packages/react/src/ReactHooks.js (JavaScript)

Code before:
  reducer: (S, A) => S,
  initialArg: I,
  init?: I => S,
): [S, Dispatch<A>] {
  const dispatcher = resolveDispatcher();
  return dispatcher.useReducer(reducer, initialArg, init);
}

export function useRef<T>(initialValue: T): {current: T} {
  const dispatcher = resolveDispatcher();
  return dispatcher.useRef(initialValue);
}

export function useEffect(
  create: (() => (() => void) | void) | (() => {...} | void | null),
  createDeps: Array<mixed> | void | null,
  update?: ((resource: {...} | void | null) => void) | void,
  updateDeps?: Array<mixed> | void | null,
  destroy?: ((resource: {...} | void | null) => void) | void,
): void {
  if (__DEV__ && create == null) {
    console.warn(
      'React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?',
    );
  }

  const dispatcher = resolveDispatcher();
  if (
    enableUseEffectCRUDOverload &&
    (typeof update === 'function' || typeof destroy === 'function')
  ) {
    // $FlowFixMe[not-a-function] This is unstable, thus optional
    return dispatcher.useEffect(
      create,
      createDeps,
      update,
      updateDeps,
      destroy,
    );
  } else if (typeof update === 'function') {
    throw new Error(
      'useEffect CRUD overload is not enabled in this build of React.',
    );
  }
  return dispatcher.useEffect(create, createDeps);
}

export function useInsertionEffect(
  create: () => (() => void) | void,
  deps: Array<mixed> | void | null,
): void {

Review comment (suggestion):
We inline the body of the `if (__DEV__)` condition so it's fine to split them up like this:

```suggestion
  if (__DEV__ ) {
    if (create == null) {
      console.warn(
        'React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?',
      );
    }
  }

```

Code after:
  reducer: (S, A) => S,
  initialArg: I,
  init?: I => S,
): [S, Dispatch<A>] {
  const dispatcher = resolveDispatcher();
  return dispatcher.useReducer(reducer, initialArg, init);
}

export function useRef<T>(initialValue: T): {current: T} {
  const dispatcher = resolveDispatcher();
  return dispatcher.useRef(initialValue);
}

export function useEffect(
  create: (() => (() => void) | void) | (() => {...} | void | null),
  createDeps: Array<mixed> | void | null,
  update?: ((resource: {...} | void | null) => void) | void,
  updateDeps?: Array<mixed> | void | null,
  destroy?: ((resource: {...} | void | null) => void) | void,
): void {
  if (__DEV__) {
    if (create == null) {
      console.warn(
        'React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?',
      );
    }
  }

  const dispatcher = resolveDispatcher();
  if (
    enableUseEffectCRUDOverload &&
    (typeof update === 'function' || typeof destroy === 'function')
  ) {
    // $FlowFixMe[not-a-function] This is unstable, thus optional
    return dispatcher.useEffect(
      create,
      createDeps,
      update,
      updateDeps,
      destroy,
    );
  } else if (typeof update === 'function') {
    throw new Error(
      'useEffect CRUD overload is not enabled in this build of React.',
    );
  }
  return dispatcher.useEffect(create, createDeps);
}

export function useInsertionEffect(
  create: () => (() => void) | void,