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

1.0.0 • Public • Published

Features

  • Don't Do it!
  • Run Now!
  • Dynamically call useEffects via the virtual dom

Install

npm install do-effect

Quickstart

import {useState, useMemo} from 'react';
import { DoEffect } from 'do-effect';

interface AppProps {
  children: React;
  doAThing: () => void;
}

function App({ children, doAThing }: AppProps) {
  const [loading, setLoading] = useState(true);

  return (
    <div>
      {loading && (
        <DoEffect
          effect={() => {
            doAThing();
            setLoading(false);
          }}
        />
      )}
      {children}
    </div>
  );
}

Package Sidebar

Install

npm i do-effect

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.87 kB

Total Files

4

Last publish

Collaborators

  • scrumrot