Device SupportGroup Support
useProps(selector?: (props: DpState) => DpValue;, equalityFn?: (prevDpValue: DpValue, nextDpValue: DpValue) => boolean)
Requires:
@ray-js/panel-sdk≥1.2.0
Description
Get smart device DP states; re-renders the component when DPs change
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
selector | (props: DpState) => DpValue; | No | Selector function. The input is the full DP state in the current device context. Specific properties are inferred from the as const Schema defined in devices/schema.ts. Type mapping: bool → boolean, value/bitmap → number, enum/string/raw → string. See sample code |
equalityFn | (prevDpValue: DpValue, nextDpValue: DpValue) => boolean | No | Custom comparator; returning true prevents re-render |
Return Value
Type: DpValue
DP value returned by the selector; its type is based on the project-provided Schema and is inferred from property.type
Referenced Types
type
DpStateDatapoint status object, where the key is the datapoint code and the value is the datapoint value.type
DpValueDatapoint value type, which can be boolean, number, or string.