Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 578 Bytes

File metadata and controls

38 lines (24 loc) · 578 Bytes

tinky


tinky / useApp

Function: useApp()

useApp(): AppProps

useApp is a React hook that exposes a method to manually exit the app (unmount).

Returns

AppProps

The app context containing the exit function.

Example

import { render, useApp, useInput } from "tinky";

const Component = () => {
  const { exit } = useApp();

  useInput((input) => {
    if (input === "q") {
      exit();
    }
  });

  return null;
};

render(<Component />);