Record: {recordId ?? 'none'}
User: {userId ?? 'anonymous'}
);
};
```
该上下文是响应式的——如果周围的记录发生变化,钩子会自动返回更新后的值。
#### 宿主 API 函数
前端组件在隔离的沙箱中运行,但可以通过宿主提供的一组函数与 Twenty 的 UI 进行交互。 直接从 `twenty-sdk` 导入它们:
```typescript
import {
navigate,
closeSidePanel,
enqueueSnackbar,
unmountFrontComponent,
openSidePanelPage,
openCommandConfirmationModal,
} from 'twenty-sdk';
```
| 函数 | 签名 | 描述 |
| ------------------------------ | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `导航` | `(to, params?, queryParams?, options?) => Promise