react-use-notifier
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

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}/>}
/>

Package Sidebar

Install

npm i react-use-notifier

Weekly Downloads

7

Version

0.4.1

License

MIT

Unpacked Size

12 kB

Total Files

8

Last publish

Collaborators

  • mabiloft