Skip to main content

useRecord

Gets information of a specified record. Rerendering is triggered when the value of record, field property changes.

If not ID is passed in, undefined is returned.

Parameters

NameTypeDescription
recordIdstring | undefinedThe ID for this record.

Returns

DynamicRecord

Example

import { useRecord } from '@apitable/widget-sdk';

// Show record title
function RecordTitle() {
const record = useRecord('recXXXXXXX');
return <p>{record.title}</p>
}

useRecord(datasheet, recordId): DynamicRecord

Support for loading the corresponding datasheet data record.

Parameters

NameTypeDescription
datasheetDatasheetDatasheet instance, by useDatasheet get.
recordIdstring | undefinedThe ID for this record.

Returns

DynamicRecord

Example

import { useRecord, useDatasheet } from '@apitable/widget-sdk';

// Show the primary key of record the corresponding to the datasheetId(dstXXXXXXXX) datasheet
function RecordTitle() {
const datasheet = useDatasheet('dstXXXXXXXX);
const record = useRecord('recXXXXXXX');
return <p>{record.title}</p>
}