React-server data bundle cache
Cache the data for react-server
pages for blazing fast client transitions.
Usage
First, install the module:
npm install --save react-server-data-bundle-cache
Then, install the cache:
DataBundleCache;
Then, opt into bundle caching in pages:
{ DataBundleCache; ... } ...
Then, link to your page with the bundleData
option:
<Link bundleData=true path="/mypage">My page</Link>
If you really want to be slick, preload the bundle:
DataBundleCache;
Options:
ttl
: How long (in milliseconds) a bundle is good for.max
: How many bundles may be kept in the cache.
Pass options as an object to the install
method:
DataBundleCache;
That's it! Enjoy! 🚀