Skip to content

value

Property to get the current value of the Signify state.

Description

The value property provides direct access to the current state value without subscribing to changes. This is useful for reading the state outside of React components or when you need the current value without triggering re-renders.

Input/Output

InputTypeDescription
None-Read-only property access
OutputTypeDescription
ReturnsTCurrent state value

Example

typescript
import { signify } from 'react-signify';

const sCounter = signify(10);
const sUser = signify({ name: 'John', age: 25 });

// Get current values
console.log(sCounter.value); // 10
console.log(sUser.value); // { name: 'John', age: 25 }

// Use in event handlers
const handleSubmit = () => {
  const currentUser = sUser.value;
  console.log('Submitting:', currentUser.name);
};

// Check value before updating
const increment = () => {
  if (sCounter.value < 100) {
    sCounter.set(sCounter.value + 1);
  }
};

Released under the MIT License.