@micro-cube/reactive
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

REACTIVE

简介

基于 FunctionProxy 的响应式核心

安装

# npm
npm i @micro-cube/reactive
# or yarn
yarn i @micro-cube/reactive
# or pnpm
pnpm i @micro-cube/reactive

案例

import { useReactive, useEffect } from '@micro-cube/reactive'

// 创建响应式对象
const data = useReactive(1)
let double = NaN

useEffect(() => {
  // 读取data, 不加参数为读取操作
  double = data() * 2
})

console.log(double) // 2

// data写入3,加参数为写入操作
data(3)
console.log(double) // 6

测试

测试用例

Package Sidebar

Install

npm i @micro-cube/reactive

Weekly Downloads

1

Version

1.1.6

License

MIT

Unpacked Size

15.9 kB

Total Files

23

Last publish

Collaborators

  • shewulong