Function PendingSubmissionsContextProvider

  • React Component that provides the context for the usePendingSubmissions() hook to be used by components further down your component tree. It should only be included in your component tree once and ideally at the root of the application.

    Example

    import * as React from 'react'
    import {
    PendingSubmissionsContextProvider,
    usePendingSubmissions,
    } from '@oneblink/apps-react'

    function Component() {
    const pendingSubmissionsContext = usePendingSubmissions()
    // use pending submissions here
    }

    function App() {
    return (
    <PendingSubmissionsContextProvider
    isPendingQueueEnabled
    successNotificationTimeoutMs={3000}
    >
    <Component />
    </PendingSubmissionsContextProvider>
    )
    }

    const root = document.getElementById('root')
    if (root) {
    ReactDOM.render(<App />, root)
    }

    Parameters

    • props: {
          children: ReactNode;
          isPendingQueueEnabled: boolean;
          successNotificationTimeoutMs?: number;
      }
      • children: ReactNode

        Your application components

      • isPendingQueueEnabled: boolean

        true if pending queue is enabled, otherwise false. Can be used prevent offline submissions from being processed.

      • Optional successNotificationTimeoutMs?: number

        When a submission is processed successfully the isShowingSuccessNotification will be temporarily set to true, it will be set back to false after 5 seconds. This prop will allow you to customise how long to wait before hiding the notification with a milliseconds value.

    Returns Element