How to use the react-use.useGetSet function in react-use

To help you get started, we’ve selected a few react-use examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pingcap / tidb-dashboard / ui / lib / apps / KeyViz / components / KeyViz.tsx View on Github external
const KeyViz = () => {
  const [chartState, setChartState] = useState()
  const [getSelection, setSelection] = useGetSet(null)
  const [isLoading, setLoading] = useState(true)
  const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
  const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
  const [getOnBrush, setOnBrush] = useGetSet(false)
  const [getDateRange, setDateRange] = useGetSet(3600 * 6)
  const [getBrightLevel, setBrightLevel] = useGetSet(1)
  const [getMetricType, setMetricType] = useGetSet('written_bytes')
  const [config, setConfig] = useState(null)
  const {
    state: shouldShowSettings,
    setTrue: openSettings,
    setFalse: closeSettings,
  } = useBoolean(false)
  const { t } = useTranslation()

  const enabled = config?.auto_collection_enabled === true

  const updateServiceStatus = useCallback(async function () {
    setLoading(true)
    try {
      const resp = await client.getInstance().keyvisualConfigGet()
      const config = resp.data
      const enabled = config?.auto_collection_enabled === true
github pingcap / tidb-dashboard / ui / lib / apps / KeyViz / components / KeyViz.tsx View on Github external
const KeyViz = () => {
  const [chartState, setChartState] = useState()
  const [getSelection, setSelection] = useGetSet(null)
  const [isLoading, setLoading] = useState(true)
  const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
  const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
  const [getOnBrush, setOnBrush] = useGetSet(false)
  const [getDateRange, setDateRange] = useGetSet(3600 * 6)
  const [getBrightLevel, setBrightLevel] = useGetSet(1)
  const [getMetricType, setMetricType] = useGetSet('written_bytes')
  const [config, setConfig] = useState(null)
  const {
    state: shouldShowSettings,
    setTrue: openSettings,
    setFalse: closeSettings,
  } = useBoolean(false)
  const { t } = useTranslation()

  const enabled = config?.auto_collection_enabled === true

  const updateServiceStatus = useCallback(async function () {
github pingcap / tidb-dashboard / ui / lib / apps / KeyViz / components / KeyViz.tsx View on Github external
const KeyViz = () => {
  const [chartState, setChartState] = useState()
  const [getSelection, setSelection] = useGetSet(null)
  const [isLoading, setLoading] = useState(true)
  const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
  const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
  const [getOnBrush, setOnBrush] = useGetSet(false)
  const [getDateRange, setDateRange] = useGetSet(3600 * 6)
  const [getBrightLevel, setBrightLevel] = useGetSet(1)
  const [getMetricType, setMetricType] = useGetSet('written_bytes')
  const [config, setConfig] = useState(null)
  const {
    state: shouldShowSettings,
    setTrue: openSettings,
    setFalse: closeSettings,
  } = useBoolean(false)
  const { t } = useTranslation()

  const enabled = config?.auto_collection_enabled === true

  const updateServiceStatus = useCallback(async function () {
    setLoading(true)
    try {
github pingcap / tidb-dashboard / ui / lib / apps / KeyViz / components / KeyViz.tsx View on Github external
const KeyViz = () => {
  const [chartState, setChartState] = useState()
  const [getSelection, setSelection] = useGetSet(null)
  const [isLoading, setLoading] = useState(true)
  const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
  const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
  const [getOnBrush, setOnBrush] = useGetSet(false)
  const [getDateRange, setDateRange] = useGetSet(3600 * 6)
  const [getBrightLevel, setBrightLevel] = useGetSet(1)
  const [getMetricType, setMetricType] = useGetSet('written_bytes')
  const [config, setConfig] = useState(null)
  const {
    state: shouldShowSettings,
    setTrue: openSettings,
    setFalse: closeSettings,
  } = useBoolean(false)
  const { t } = useTranslation()

  const enabled = config?.auto_collection_enabled === true

  const updateServiceStatus = useCallback(async function () {
    setLoading(true)
    try {
      const resp = await client.getInstance().keyvisualConfigGet()
github pingcap / tidb-dashboard / ui / lib / apps / KeyViz / components / KeyViz.tsx View on Github external
const KeyViz = () => {
  const [chartState, setChartState] = useState()
  const [getSelection, setSelection] = useGetSet(null)
  const [isLoading, setLoading] = useState(true)
  const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
  const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
  const [getOnBrush, setOnBrush] = useGetSet(false)
  const [getDateRange, setDateRange] = useGetSet(3600 * 6)
  const [getBrightLevel, setBrightLevel] = useGetSet(1)
  const [getMetricType, setMetricType] = useGetSet('written_bytes')
  const [config, setConfig] = useState(null)
  const {
    state: shouldShowSettings,
    setTrue: openSettings,
    setFalse: closeSettings,
  } = useBoolean(false)
  const { t } = useTranslation()

  const enabled = config?.auto_collection_enabled === true

  const updateServiceStatus = useCallback(async function () {
    setLoading(true)
    try {
      const resp = await client.getInstance().keyvisualConfigGet()
      const config = resp.data
github pingcap / tidb-dashboard / ui / lib / apps / KeyViz / components / KeyViz.tsx View on Github external
const KeyViz = () => {
  const [chartState, setChartState] = useState()
  const [getSelection, setSelection] = useGetSet(null)
  const [isLoading, setLoading] = useState(true)
  const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
  const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
  const [getOnBrush, setOnBrush] = useGetSet(false)
  const [getDateRange, setDateRange] = useGetSet(3600 * 6)
  const [getBrightLevel, setBrightLevel] = useGetSet(1)
  const [getMetricType, setMetricType] = useGetSet('written_bytes')
  const [config, setConfig] = useState(null)
  const {
    state: shouldShowSettings,
    setTrue: openSettings,
    setFalse: closeSettings,
  } = useBoolean(false)
  const { t } = useTranslation()

  const enabled = config?.auto_collection_enabled === true