@roddynpm/bs-swr

0.3.0 • Public • Published

bs-swr

BuckleScript bindings to SWR.

Installation

Add

"@roddynpm/bs-swr": "^0.2.5",
"swr": "^0.2.0",

as dependencies to package.json and @roddynpm/bs-swr to bsconfig.json.

Example

[@react.component]
let make = () => {
  let config = Swr.Options.make(~dedupingInterval=6000, ());
  let Swr.{data} = Swr.useSWR(~config, "key", _ => load_data());

  switch (data) {
  | Some(data) => render(data)
  | None => render_loading()
  };
};

Package Sidebar

Install

npm i @roddynpm/bs-swr

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

11.3 kB

Total Files

10

Last publish

Collaborators

  • roddynpm