Skip to content

Commit

Permalink
[chore]: useSupported organized
Browse files Browse the repository at this point in the history
  • Loading branch information
changeelog committed May 30, 2024
1 parent 64ccabe commit 1d2401e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
7 changes: 7 additions & 0 deletions hooks/Utilities/useSupported/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# useSupported

## 0.0.1

### Patch Changes

- [`31c740f`](https://github.com/changeelog/react-hooks/commit/31c740ffefc5d198882820eccd79e5dc3fb528e3#diff-89a99f3436d90c4414b314d9a0d39795e0af40e3a22840bd8ede7275b2ed196c)- Introduced useSupported
19 changes: 19 additions & 0 deletions hooks/Utilities/useSupported/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# useSupported

SSR compatibility `isSupported`

Please refer to the [documentation](#) for more information.

## Installation

```bash
npx changeelog/reactuse@latest add useSupported
```

## Contribution

Yes please! See the [contributing guidelines](#) for more details!

## License

This project is licensed under the terms of the [MIT License](/LICENSE)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react'
import { useSupported } from './useSupported'
import { useSupported } from '../useSupported'

describe('useSupported', () => {
test('should return true if the feature is supported', () => {
Expand Down
1 change: 1 addition & 0 deletions hooks/Utilities/useSupported/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useSupported'
19 changes: 19 additions & 0 deletions hooks/Utilities/useSupported/useSupported.demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import { useSupported } from './useSupported'

const UseSupportedDemo: React.FC = () => {
const isClipboardSupported = useSupported(() => !!navigator.clipboard)

return (
<div>
<h1>Clipboard API Support</h1>
{isClipboardSupported ? (
<p>Clipboard API is supported!</p>
) : (
<p>Clipboard API is not supported.</p>
)}
</div>
)
}

export default UseSupportedDemo

0 comments on commit 1d2401e

Please sign in to comment.