@rocketmakers/api-swr
Version:
Rocketmakers front-end library for parsing a generated Typescript API client into a set of configurable React hooks for fetching and mutating data.
12 lines (11 loc) • 439 B
JavaScript
'use client';
/*
* React provider for SWR config & state
* --------------------------------------
* Wraps the native SWRConfig provider, see here: https://swr.vercel.app/docs/advanced/cache
*/
import * as React from 'react';
import { SWRConfig } from 'swr';
export const ApiSwrProvider = ({ children, value }) => {
return React.createElement(SWRConfig, { value: Object.assign({ provider: () => new Map() }, value) }, children);
};