Function useDopt

  • Alpha

    A React Hook for accessing a Journey's Model Block State and methods corresponding to an intent-based API for maniuplating said state.

    Example

     import { useDopt } from '@dopt/react';
    import { Modal } from '@your-company/modal';

    export function Application() {
    const [{ active }, { complete }] = useDopt('HNWvcT78tyTwygnbzU6SW');
    return (
    <main>
    <Modal
    isOpen={active}
    title="👏 Welcome to your first journey!"
    footerItems={{
    primaryActions: [{ label: 'Got it', onClick: complete }],
    }}
    >
    <Text>
    This is your onboarding experience!
    </Text>
    </Modal>
    </main>
    );
    }

    Returns

    [Block, Methods] - The state of the Block for

    Parameters

    • identifier: string

      the "Reference Id" for some Journey Model Block

    Returns [Block, Methods]

Generated using TypeDoc