1.0.0 • Published 3 months ago

react-hook-usemutable v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

react-hook-usemutable

npm GitHub Repo stars GitHub GitHub last commit Issues

A utility to simplify the use of the @mutableJS/core reactivity with React.

Installation

Install with npm:

    npm install @mutablejs/core react-hook-usemutable

Install with yarn:

    yarn add @mutablejs/core react-hook-usemutable

Keep in mind the repository depends on the @mutablejs/core package.

Usage/Examples

initialize inside of components

import { mutable } from '@mutablejs/core';
import useMutable from 'react-hook-usemutable';

const magicValue = mutable(0);

// Demoing value change
setInterval(() => {
	magicValue.value++;
}, 500);

function ShowSomeMagic() {
	const value = useMutable(magicValue);

	return `Current value: ${value}`;
}

As a state container / store

import { mutable } from '@mutablejs/core';
import { createUseMutable } from 'react-hook-usemutable';

const magicValue = mutable(0);

const useMagicValue = createUseMutable(magicValue);

// Demoing value change
setInterval(() => {
	magicValue.value++;
}, 500);

function ShowSomeMagic() {
	const value = useMagicValue();

	return `Current value: ${value}`;
}

Authors

Feedback

Any feedback? Join our Discord server and reach out to us.\ We are open to suggestions, ideas and collaboration.

Support

Love open source? Enjoying my project?\ Your support can keep the momentum going! Consider a donation to fuel the creation of more innovative open source software.

via Ko-FiBuy me a coffeevia PayPal
ko-fi
1.0.0

3 months ago

0.5.5

10 months ago

0.5.41

10 months ago

0.5.4

10 months ago

0.5.3

10 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.5.0

10 months ago