1.0.1 • Published 11 months ago

@theafolayan/mmkv-swr-cache v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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)

1.0.1

11 months ago

1.0.0

11 months ago