events-hook

1.0.1 • Public • Published

events-hook

Easily sharing state between component

Example

import { useGetValue } from "events-hook";

export const Receiver = () => {
    const value = useGetValue("test");
    return <div>{JSON.stringify(value)}</div>;
};
import { useSetValue } from "events-hook";

export const Setter = () => {
    const setter = useSetValue("test");
    return (
        <input
            onChange={(currentEvent) => {
                setter(currentEvent.target.value);
            }}
        />
    );
};

See example/ for a working example

License

Licensed under the MIT License - LICENSE

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i events-hook

    Weekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • n4n5