apollo-state-sync - API Reference (Users)
    Preparing search index...

    Function makeVarSynced

    • Creates a reactive variable synchronized across browsing contexts. It is a swap-in replacement for makeVar.

      Type Parameters

      • T

      Parameters

      • value: T

        Initial value of the reactive variable.

      • uniqueName: string

        A unique identifier used to synchronize the variable across contexts.

      • Optionalconfig: RVarSyncedConfigType<T>

      Returns ReactiveVarSynced<T>

      import { useReactiveVar } from '@apollo/client/react'
      import { makeVarSynced } from 'apollo-state-sync'

      const rVarSynced = makeVarSynced('random-value','a-unique-name')