1.0.0 • Published 1 year ago

react-use-value v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

React useValue

NPM badge Dependabot badge Dependencies Build Status Coverage Status

Solves the problem of updating an internal component based on values passed in from a different source that can be updated independently.

Usage

You have an initial text value of "John Doe" loaded and kept in sync with the source of the value e.g. web API, and need the field holding that value updated to "Jane Doe" without affecting the parent but also be reset to the parent value when it's changed to a newer version like "John M. Doe".

Example code

import { useValue, useTrackedValue, useSyncedValue } from 'react-use-value';

See type documentation for details on how each is used.

Demo

synced input values

Edit on StackBlitz ⚡️