New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-speculation-rules

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-speculation-rules

Speculation API component for react.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

React Speculation Rules

React component for setting pre-render and pre-fetch speculation rules using the speculation rule API.

How it works

  • Specify the rules for pre-fetching and pre-rendering resources and pages using the speculation rules API.

  • This component generates a <script> tag with speculation rules, so it's recommended to place the component towards the bottom of the page.

How to use

Install

Installation: npm install react-speculation-rules

Usage

Import the package into your app:

import {SpeculationRules} from "react-speculation-rules";

Speculation Rules Example:

    <SpeculationRules preRenderEagerness="moderate" preFetchEagerness="moderate" hrefMatches={["/*", "/example-page-one"]} excludeHrefs={["/logout", "/*\\?*(^|&)add-to-cart=*", ".no-prerender"]} excludeSelectors={["[rel~=nofollow]"]} prefetchUrls={["/", "/example-page-two"]}></SpeculationRules>

Component Configuration:

-  `preRenderEagerness`
    [Required] Takes a sting of "immediate", "eager", "moderate" or "conservative".

-  `preFetchEagerness`
    [Required] Takes a sting of "immediate", "eager", "moderate" or "conservative".

-  `hrefMatches`
    [Optional] Takes an array of url strings.

-  `excludeHrefs`
    [Optional] Takes an array of url strings.

-  `excludeSelectors`
    [Optional] Takes an array of HTML selector strings.

-  `prefetchUrls`
    [Optional] Takes an array of url strings.

-  `referrerPolicy`
    [Optional] Takes a string.

-  `requires`
    [Opitonal] currently only accepts "anonymous-client-ip-when-cross-origin" which is its default value.

Keywords

React

FAQs

Package last updated on 21 Sep 2024

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