useDirty

Returns a boolean indicating if the current record has unsaved changes.

Example

import { useDirty } from "@olenbetong/appframe-react";

function MySaveButton() {
  let dirty = useDirty(dsMyDataObject);
  return (
    <Button onClick={() => dsMyDataObject.endEdit()}>
      <Badge invisible={!dirty} color="secondary" variant="dot">
        <Save />
      </Badge>
    </Button>
  );
}

API

export declare function useDirty(dataObject: DataObject<any>): boolean;

Last updated

Was this helpful?