@theafolayan/mmkv-swr-cache
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mmkv-swr-cache

A custom cache provider for SWR using MMKV storage in React Native projects.

Installation

First, install the package using your favorite package manager:

Expo

npx expo install @theafolayan/mmkv-swr-cache

Yarn

yarn add @theafolayan/mmkv-swr-cache

NPM

npm install @theafolayan/mmkv-swr-cache

Ensure you have swr and react-native-mmkv installed as well:

npx expo install swr react-native-mmkv

Usage

To use the MMKV cache provider in your React Native project, wrap your application with the SWRConfig provider, using the custom MMKVCacheProvider.

Example

import React from 'react';
import { SWRConfig } from 'swr';
import MMKVCacheProvider from '@theafolayan/mmkv-swr-cache';

const App: React.FC = () => {
  return (
    <SWRConfig value={{ provider: MMKVCacheProvider }}>
      <App />
    </SWRConfig>
  );
};

export default App;

License

This project is licensed under the MIT License

Support

To show your support for this project (if you found it useful of course) please consider starring the repo and following me on Twitter (x)

Package Sidebar

Install

npm i @theafolayan/mmkv-swr-cache

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

5.01 kB

Total Files

9

Last publish

Collaborators

  • theafolayan