How to Get the selected record?

This does not work. It throws some exceptions.

useLoadable(cursor);
useWatchable(cursor, ['activeTableId', 'selectedRecordIds']);
const table = base.getTableById(cursor.activeTableId);
const record = useRecordById(table, cursor.selectedRecordIds[0]);

This works. But is this the correct way to do it? Feels like there should be a much simpler way to do this.

useLoadable(cursor);
useWatchable(cursor, ['activeTableId', 'selectedRecordIds']);
const table = base.getTableById(cursor.activeTableId);
const queryResult = table.selectRecords();
let record = null;
try {
    record = queryResult.getRecordById(cursor.selectedRecordIds[0]);
} catch (e) {
    record = null;
}

@Ashwin_P What version of the SDK are you using? Support for useRecordById(table, recordId) was added in 0.0.42 (you can view the changelog here).

If that doesn’t fix it, can you share what exceptions are being thrown?