allotize-react

  • ?: optional
import {useAllotizeState} from 'allotize-react';

const [allotize, setAllotize] = useAllotizeState({
    route: "counter",
    ?config: {
        // Specifies if the resource should be persisted
        persist: '?bool',
        // Callback when a change is made to the resouce
        onChange: '?function',
        // Callback for when a local change is made to the resouce
        onLocalChange: '?function',
        // Callback for when a remote change is made to the resouce
        onRemoteChange: '?function',
        // List of callbacks to call when a change is made to the resouce
        onChangeCallbacks: '?array[]function',
        // Throttle interval for sending and syncing changes
        throttleInterval: '?int (ms) [DEFAULT=350ms]',
    }
    state: {
        count: 0,
    }
});