biSyncRef

Two-way refs synchronization.

Usage

import { biSyncRef } from '@vueuse/core'

const a = ref('a')
const b = ref('b')

const stop = biSyncRef(a, b)

console.log(a.value) // a

b.value = 'foo'

console.log(a.value) // foo

a.value = 'bar'

console.log(b.value) // bar
  • syncRef

Type Declarations

/**
 * Two-way refs synchronization.
 *
 * @param a
 * @param b
 */
export declare function biSyncRef<R extends Ref<any>>(a: R, b: R): () => void

Source

SourceDemoDocs