useDraxId
Generate a stable unique ID for a Drax view. Useful when you need to reference a view's ID from external code.
Import
import { useDraxId } from 'react-native-drax';
Usage
function MyComponent() {
const draxId = useDraxId();
return (
<DraxView id={draxId}>
<Text>My view ID: {draxId}</Text>
</DraxView>
);
}
Return Value
| Type | Description |
|---|---|
string | A unique, stable ID string |
The ID is generated once and remains stable across re-renders.
Related
- DraxView —
idprop