Socket
Socket
Sign inDemoInstall

@vue/reactivity

Package Overview
Dependencies
1
Maintainers
1
Versions
206
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vue/reactivity

@vue/reactivity


Version published
Weekly downloads
3.1M
increased by1.41%
Maintainers
1
Install size
293 kB
Created
Weekly downloads
 

Package description

What is @vue/reactivity?

The @vue/reactivity package is part of the Vue.js framework, designed to provide a standalone reactivity system that can be used outside of Vue components. It allows developers to create reactive objects and track changes to them, enabling the development of responsive applications. The package includes features such as reactive state, computed values, and watchers.

What are @vue/reactivity's main functionalities?

Creating reactive objects

This feature allows you to create a reactive object. Any changes to the object's properties will be tracked, making it useful for building responsive interfaces.

import { reactive } from '@vue/reactivity';
const state = reactive({ count: 0 });

Creating computed properties

Computed properties automatically calculate their value based on reactive state. They are recalculated only when their dependencies change, making them efficient.

import { computed } from '@vue/reactivity';
const count = reactive({ num: 1 });
const plusOne = computed(() => count.num + 1);

Watching for changes

The watch function allows you to execute a callback function whenever a specified reactive property changes, enabling you to respond to changes in the state.

import { watch } from '@vue/reactivity';
const state = reactive({ count: 0 });
watch(() => state.count, (newVal, oldVal) => {
  console.log(`Count changed from ${oldVal} to ${newVal}`);
});

Other packages similar to @vue/reactivity

Changelog

Source

3.4.0-beta.1 (2023-12-13)

Bug Fixes

  • compiler-core: use the same resolved options for all compile stages (#9760) (0dc875d)
  • hydration: should not warn mismatch for nullish prop (33159a5)
  • hydration: swap client/server labels for hydration mismatch warnings (f41fd86), closes #9098 #5953
  • runtime-core: fix suspense crash when patching non-resolved async setup component (#7290) (bb0c889), closes #5993 #6463 #6949 #6095 #8121
  • runtime-core: properly pop warning context when mounting components with async setup (69a2acc)
  • ssr: fix suspense hydration of fallback content (#7188) (60415b5)
  • ssr: make isInSSRComponentSetup state sharable across copies of Vue (e04d821)
  • Suspense: handle switching away from kept-alive component before resolve (aa0c13f), closes #6416 #6467
  • Suspense: properly fix #6416 (0db336f)
  • types: add xmlns:xlink to SVGAttributes (#9300) (0d61b42), closes #9299
  • types: support for generic keyof slots (#8374) (213eba4)

Features

Performance Improvements

Readme

Source

@vue/reactivity

Usage Note

This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. @vue/runtime-dom), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.

For full exposed APIs, see src/index.ts.

Credits

The implementation of this module is inspired by the following prior art in the JavaScript ecosystem:

Caveats

  • Built-in objects are not observed except for Array, Map, WeakMap, Set and WeakSet.

Keywords

FAQs

Last updated on 13 Dec 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc