use-style-link
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

useStyleLink

NPM

publish workflow npm version

A React hook for inserting the identical style link.

Support SSR scene.

Install

yarn add use-style-link (or by npm)

Usage

import { useStyleLink } from 'use-style-link'

const App = () => {
    useStyleLink('https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css')

    return (
        <div>Hello world</div>
    )
}

Signature

const useStyleLink: (url: string, autoClear?: boolean, isSameLink?: (link1: string, link2: string) => boolean) => void

by default, it won't clear the inserted style link automatically for performance consideration.

Package Sidebar

Install

npm i use-style-link

Weekly Downloads

12

Version

1.0.6

License

MIT

Unpacked Size

4.14 kB

Total Files

5

Last publish

Collaborators

  • zheeeng