Created
August 8, 2025 09:22
-
-
Save enpitsuLin/ec7563684228b0b9c4af9f5d26e087f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use client' | |
| import { useIsomorphicLayoutEffect } from 'some-lib-or-your-source' | |
| import { DependencyList, useState } from 'react' | |
| export function useSupport(assert: () => boolean, deps: DependencyList = []) { | |
| const [support, setSupport] = useState(false) | |
| useIsomorphicLayoutEffect(() => { | |
| setSupport(assert()) | |
| }, deps) | |
| return support | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment