useModelChoices
Overview
Provides a reactive object for a given app, model, and field. This composition function is designed to preserve deep references within the choices object, preventing them from breaking when the app, model, or field changes.
This function deeply mirrors (watches and clones) the model choices, which assumes that the choices data has low churn. Frequent updates could have performance implications due to the deep cloning process.
Signature
useModelChoices(fields, isActive)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| fields | ChoicesOptions | yes | Field name(s) to fetch choices for. |
| isActive | Readonly | no | An IsActive instance, if one can be reused. |
Returns
An object containing reactive fields and actions for model choices.
Source
client/lib/use/useModelChoices.js:55