0.2.2 • Published 3 years ago

use-signal v0.2.2

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

use-signal

simple hook to create and dispatch events across a react like app

Usage

// signal.ts
import {createSignal} from "use-signal";

export const signal = createSignal(); // or createSignal("name");

// App.ts

import {signal} from "./signal";
import {useSignal} from "use-signal/react";
function App() {
  useSignal(signal, callback);
  //...
}
// somewhere else

import {dispatchSignal} from "use-signal";
import {signal} from "./signal";

dispatchSignal(signal); // callback is called in App.ts
0.2.1

3 years ago

0.1.1

3 years ago

0.2.2

3 years ago

0.1.0

3 years ago