How to use the react-fxxking-hooks.useInterval function in react-fxxking-hooks

To help you get started, we’ve selected a few react-fxxking-hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FE-Kits / fractal-components / fc-iot / packages / fc-iot-react / src / pages / page-a / components / ExampleModal / index.tsx View on Github external
export const ExampleModal = (props: ExampleModalProps) => {
  const { className, show, onOK = noop, onCancel = noop } = props;

  // The following is a simple example of how to use React hooks.
  const [time, setTime] = React.useState(0);
  React.useEffect(() => {
    // Reset time.
    setTime(0);
  }, [show]);
  useInterval(() => setTime(prevTime => prevTime + 1), 1000, !show);

  return (
    
      <div>
        <header>
          <h6>Dialog</h6>
        </header>
        <div>
          <div>Press Esc or click the buttons.</div>
          <div>
            Time Elapsed: <span>{`${time}s`}</span>
          </div>
        </div>
        <div>
          <div>
            Cancel</div></div></div>
github FE-Kits / m-fe-rtw / packages / rtw-host-app / src / pages / page-a / components / ExampleModal / index.tsx View on Github external
export const ExampleModal = (props: ExampleModalProps) =&gt; {
  const { className, show, onOK = noop, onCancel = noop } = props;

  // The following is a simple example of how to use React hooks.
  const [time, setTime] = React.useState(0);
  React.useEffect(() =&gt; {
    // Reset time.
    setTime(0);
  }, [show]);
  useInterval(() =&gt; setTime(prevTime =&gt; prevTime + 1), 1000, !show);

  return (
    
      <div>
        <header>
          <h6>Dialog</h6>
        </header>
        <div>
          <div>Press Esc or click the buttons.</div>
          <div>
            Time Elapsed: <span>{`${time}s`}</span></div></div></div>

react-fxxking-hooks

Collection of React Hooks.

WTFPL
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Popular react-fxxking-hooks functions