https://github.com/zheeeng/use-style-link
A React hook for inserting the identical style link.
https://github.com/zheeeng/use-style-link
hooks react-hooks style style-link style-sheet use-style-link
Last synced: about 1 year ago
JSON representation
A React hook for inserting the identical style link.
- Host: GitHub
- URL: https://github.com/zheeeng/use-style-link
- Owner: zheeeng
- License: mit
- Created: 2021-05-28T04:59:42.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-01T07:34:35.000Z (almost 5 years ago)
- Last Synced: 2025-02-24T20:04:28.392Z (about 1 year ago)
- Topics: hooks, react-hooks, style, style-link, style-sheet, use-style-link
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/use-style-link
- Size: 8.79 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# useStyleLink
[](https://nodei.co/npm/use-style-link/)

[](https://www.npmjs.com/package/use-style-link)
A React hook for inserting the identical style link.
Support SSR scene.
## Install
```bash
yarn add use-style-link (or by npm)
```
## Usage
```ts
import { useStyleLink } from 'use-style-link'
const App = () => {
useStyleLink('https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css')
return (
Hello world
)
}
```
## Signature
```ts
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.