useSetItemPosition
Hook that sets the absolute position of the widget on the dashboard.
Returns
An object with two setter methods for the x and the y position. The setters are like useState
state setters which can
directly take the new value or a callback with the previous value as argument.
Example
src/widgets/example/Example.tsx
import React, {useEffect} from 'react'
import {useSetItemPosition} from '@modbros/dashboard-sdk'
export default function Example() {
const {setX, setY} = useSetItemPosition()
useEffect(() => {
setX((x) => x + 1)
// or setX(10)
setY((y) => y + 1)
// or setY(10)
}, [])
return null
}