![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
vue-ref2reactive
Advanced tools
import {ref, toRefs} from 'vue'
import { toRefReactive, toRefsReactive, toRefsValue } from "vue-ref2reactive";
const objRef = ref({
name: 'wang',
age: 12
})
const {name, age} = toRefs(objRef.value)
objRef.value = {name: 'xxx', age: 13}
//now objRef.value.name !== name.value
import { ref } from 'vue'
import { toRefReactive } from "vue-ref2reactive";
const objRef = ref({
name: 'wang',
age: 12
})
const name = toRefReactive(objRef, 'name')
name.value // wang
name.value = '1'
objRef.value.name // '1'
objRef.value = {name: 'xxx', age: 13}
// name.value === 'xxx'
// If objRef doesn't have this key in the first place
const sex = toRefReactive(objRef, 'sex', 'boy')
sex.value // boy
objRef.value.sex = 'girl'
// or
objRef.value = { name: 'l', age: 16, sex: 'girl' }
sex.value // girl
import { ref, toRefs } from 'vue'
import { toRefsReactive, toRefReactive } from "vue-ref2reactive";
const objRef = ref({
name: 'wang',
age: 12
})
const obj = toRefsReactive(objRef)
obj.name // wang
obj.name = '1'
objRef.value.name // '1'
const { name, age } = toRefs(toRefsReactive(objRef))
const sex = toRefReactive(objRef, 'sex')
sex.value // undefined
name.value // 'hao'
age.value // 26
age.value++
objRef.value.age // 27
objRef.value = { name: 'new', age: 18, sex: 'boy' }
name.value // 'new'
age.value // 18
sex.value // 'boy'
import { ref } from 'vue'
import { toRefsValue } from "vue-ref2reactive";
const objRef = ref({
name: 'wang',
age: 12
})
const { name, age } = toRefsValue(objRef)
name.value // 'wang'
objRef.value = { name: 'hao', age: 26 }
name.value // 'hao'
age.value // 26
FAQs
vue ref value object to reactive
We found that vue-ref2reactive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.