signalera
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Signalera - current work in progress

Easy to use in app notification component

Example usage

Import the hook useSignalera and the Provider Signalera from signalera.

import { useSignalera, Signalera } from "signalera";

Wrap your app with desired scope of the context. In this example we have our context wrapping the entire app.

function App() {
  return (
    <Signalera>
      <div className="App">
        <Button />
      </div>
    </Signalera>
  );
}

Inside a functional component we can get the addSignal function from our hook useSignalera. title is the only required key to include in the object we pass the function. More about this in a bit.

const Button: React.FC<Props> = () => {
  const { addSignal } = useSignalera();
  return (
    <button
      onClick={() =>
        addSignal({
          title: "A nice new title",
          body: "A rich and luxurious body text",
        })
      }
    >
      Add signal
    </button>
  );
};

Package Sidebar

Install

npm i signalera

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

22.3 kB

Total Files

32

Last publish

Collaborators

  • raademar