1.0.1 • Published 1 year ago
@theafolayan/mmkv-swr-cache v1.0.1
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-cacheYarn
yarn add @theafolayan/mmkv-swr-cacheNPM
npm install @theafolayan/mmkv-swr-cacheEnsure you have swr and react-native-mmkv installed as well:
npx expo install swr react-native-mmkvUsage
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)