bringapp
    Preparing search index...

    Function initClient

    • Initializes the client with the specified WordPress URL.

      Type Parameters

      • SP = object

        SiteProps

      • M = object

        Menu

      • MI = object

        MenuItem

      Parameters

      • wpURL: string = ""

        The WordPress URL.

      Returns {
          DynamicEntity: <T = object, P = object>(
              props: EntityProps<T, P>,
          ) => null | Element;
          DynamicEntityList: <T = {}, P = {}>(
              props: DynamicEntityListProps<T, P>,
          ) => null | Element;
          useDynamicEntityList: <T = object>(
              entitySlug: string,
              entityType: EntityType,
              options?: UseDynamicEntityListOptions,
          ) =>
              | {
                  entityList: DynamicEntityList<T>;
                  params: GetDynamicEntityListParams<object>;
                  ref: (node?: null | Element) => void;
              }
              | {
                  entityList: null;
                  params: GetDynamicEntityListParams<object>;
                  ref: (node?: null | Element) => void;
              };
          useDynamicEntityProps: <T = object>(
              entityId: number,
              entityType: EntityType,
              options?: UseDynamicEntityPropsOptions,
          ) =>
              | {
                  entityProps: DynamicEntityProps<T>;
                  params: object;
                  ref: (node?: null | Element) => void;
              }
              | {
                  entityProps: null;
                  params: object;
                  ref: (node?: null | Element) => void;
              };
          useSiteProps: () => null | SiteProps<SP, M, MI>;
          useWPSendForm: <SuccessT, ErrorT, FormDataPayloadT>(
              formName: string,
              options?: { formUrl?: string } & UseSendFormOptions<
                  SuccessT,
                  ErrorT,
                  { formData: FormDataPayloadT; formName: string },
              >,
          ) => {
              data: undefined | SuccessT;
              error: undefined | Error | ErrorT;
              isError: boolean;
              isIdle: boolean;
              isLoading: boolean;
              isSuccess: boolean;
              reset: () => void;
              send: (formData: FormDataPayloadT) => Promise<void>;
              status: Status;
          };
      }

      The initialized client object.

      • DynamicEntity: <T = object, P = object>(props: EntityProps<T, P>) => null | Element

        Renders the dynamic entity on the client with the given render function.

      • DynamicEntityList: <T = {}, P = {}>(props: DynamicEntityListProps<T, P>) => null | Element

        Renders the dynamic entity list on the client with the given render function.

      • useDynamicEntityList: <T = object>(
            entitySlug: string,
            entityType: EntityType,
            options?: UseDynamicEntityListOptions,
        ) =>
            | {
                entityList: DynamicEntityList<T>;
                params: GetDynamicEntityListParams<object>;
                ref: (node?: null | Element) => void;
            }
            | {
                entityList: null;
                params: GetDynamicEntityListParams<object>;
                ref: (node?: null | Element) => void;
            }

        Retrieves the dynamic entity list.

      • useDynamicEntityProps: <T = object>(
            entityId: number,
            entityType: EntityType,
            options?: UseDynamicEntityPropsOptions,
        ) =>
            | {
                entityProps: DynamicEntityProps<T>;
                params: object;
                ref: (node?: null | Element) => void;
            }
            | {
                entityProps: null;
                params: object;
                ref: (node?: null | Element) => void;
            }

        Retrieves the dynamic entity props.

      • useSiteProps: () => null | SiteProps<SP, M, MI>

        Retrieves the site props.

      • useWPSendForm: <SuccessT, ErrorT, FormDataPayloadT>(
            formName: string,
            options?: { formUrl?: string } & UseSendFormOptions<
                SuccessT,
                ErrorT,
                { formData: FormDataPayloadT; formName: string },
            >,
        ) => {
            data: undefined | SuccessT;
            error: undefined | Error | ErrorT;
            isError: boolean;
            isIdle: boolean;
            isLoading: boolean;
            isSuccess: boolean;
            reset: () => void;
            send: (formData: FormDataPayloadT) => Promise<void>;
            status: Status;
        }

        Retrieves the WP send form hook.