1.0.1 • Published 3 years ago

uselazyswr v1.0.1

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

useLazySWR

Tiny react hook wrapped around useSWR to send requests lazily.

Same API as useSWR except returns an extra execute function.

Example

import { useLazySWR } from 'uselazyswr';

const App = () => {
  const { execute, data } = useLazySWR('/api', fetcher);
  return (
    <div>
      <p>{JSON.stringify(data)}</p>
      <button onClick={execute}>Call Api</button>
    </div>
  );
};
1.0.1

3 years ago

1.0.0

3 years ago