React Corsair - v0.0.10
    Preparing search index...

    Type Alias HistoryBlocker

    HistoryBlocker: (transaction: HistoryTransaction) => boolean | void

    A callback that is called when a history navigation is intended.

    Type declaration

      • (transaction: HistoryTransaction): boolean | void
      • Parameters

        Returns boolean | void

        true or undefined if the transaction should be blocked until HistoryTransaction.proceed is called, or false if the transaction shouldn't be blocked.

    const blocker: HistoryBlocker = transaction => {
    return hasUnsavedChanges && !confirm('Discard unsaved changes?')
    };
    const blocker: HistoryBlocker = transaction => {
    if (!hasUnsavedChanges) {
    // No unsaved changes, proceed with navigation
    transaction.proceed();
    return;
    }

    if (!confirm('Discard unsaved changes?')) {
    // User decided to keep unsaved changes
    transaction.cancel();
    }
    };