Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-server-data-bundle-cache

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-server-data-bundle-cache

React Server Data Bundle Cache

  • 0.8.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-50%
Maintainers
4
Weekly downloads
 
Created
Source

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:

import DataBundleCache from "react-server-data-bundle-cache"

DataBundleCache.install();

Then, opt into bundle caching in pages:

class MyPage {
    handleRoute() {
        DataBundleCache.optIn();
        ...
    }
    ...
}

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.preload('/mypage');

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.install({
    ttl: 10*60*1000, // Ten minutes.
    max: 10,         // Ten bundles.
});

That's it! Enjoy! :rocket:

FAQs

Package last updated on 27 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc