biSyncRef
Two-way refs synchronization.
Demo
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
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
Related Functions
syncRef
Type Declarations
/**
* Two-way refs synchronization.
*
* @param a
* @param b
*/
export declare function biSyncRef<R extends Ref<any>>(a: R, b: R): () => void
/**
* Two-way refs synchronization.
*
* @param a
* @param b
*/
export declare function biSyncRef<R extends Ref<any>>(a: R, b: R): () => void
Source
Contributors
Anthony Fu
Daiki Ojima
Antério Vieira