worb
v1.0.1
Published
Reactive container for values that can be observed for changes.
Downloads
5
Maintainers
Readme
worb
worb is a library that provides a reactive container for values that can be observed for changes. It allows you to create "Orb" instances that store values and emit change events whenever the value is updated.
Installation
You can install the worb library using npm:
npm install worb --save
Or using yarn:
yarn add worb
Usage
import { createOrb, useCreateOrb, useOrb } from 'morb';
// Create an Orb instance
const myOrb = createOrb('initial value');
// Use the Orb in a React component
function MyComponent() {
const [value, setValue] = useOrb(myOrb);
// ...
return (
// JSX rendering using the value and setValue
);
}
// ...
// Or using hook
function MyComponent() {
const myOrb = useCreateOrb('initial value');
const [value, setValue] = useOrb(myOrb);
// ...
return (
// JSX rendering using the value and setValue
);
}
Contributing
Contributions to worb are welcome! To contribute, please follow the guidelines in CONTRIBUTING.md.
License
This project is licensed under the MIT License - see the LICENSE file for details.