private assertContext()

in packages/react/src/index.tsx [173:183]


  private assertContext(fnName: string, altFnName: string) {
    if (fnName.startsWith('use')) {
      if (!isRendering())
        throw new Error(
          `${fnName} called outside the body of a function component. Did you mean to call ${altFnName}?`,
        );
    } else {
      if (isRendering())
        throw new Error(`${fnName} called inside the body of a function component. Did you mean to call ${altFnName}?`);
    }
  }