0.4.1 • Published 2 years ago
react-use-notifier v0.4.1
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}/>}
/>