Skip to content

React SDK - cant conditionally render descope based on onReady and loading state #1148

Description

@ido-weiss

Descope component cant be rendered conditionally, onReady should come from a hook and not as a callback from the component, instead of rendering a container with opacity 0 or 1 based on the loading we should be able to listen to changes and render the component.

reproduce:

    {!isLoading &&  <Descope
              flowId="sign-up-or-in-passwords-social-copy-new-demo"
              onSuccess={handleSuccess}
              onError={handleError}
              onReady={onReady}
            />}

proposition:

const { isReady } = useDescope();
    {isReady ?  <Descope
              flowId="sign-up-or-in-passwords-social-copy-new-demo"
              onSuccess={handleSuccess}
              onError={handleError}
              onReady={onReady}
            /> : <Loader/>}

and then render the component based on that, or maybe have a loader in the flow creator to style before the component is ready.
Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions