0.4.1 • Published 2 years ago

react-use-notifier v0.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Changelog

Link to versioned changelog for internal devs

useNotifier for React ⭐🚀

notifier definition

const counter = useNotifier(5);

now you can provide notifier in context

update notifier value by

counter.value = 7;

Consume value

consume with hook

this hook will subscribe component to changes

const value = useNotifierValue(counter);

watch function wrapper

you can wrap your render function with "watch" that subscribes to each notifier

return watch(() => <div children={counter.value}/>)

the following implementation does not subscribes to changes

return <div children={counter.value}/>

Watcher component wrapper

<Watcher>
    {() => <div children={counter.value}/>}
</Watcher>

or

<Watcher
    children={() => <div children={counter.value}/>}
/>
0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago