Skip to content

Commit

Permalink
chore: use useId to detect react version
Browse files Browse the repository at this point in the history
  • Loading branch information
promer94 committed Apr 17, 2022
1 parent 963e914 commit 1f9fbf6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/helper.ts
@@ -1,12 +1,14 @@
import { version } from 'react'
import React from 'react'
export const noop = () => {}

// Using noop() as the undefined value as undefined can possibly be replaced
// by something else. Prettier ignore and extra parentheses are necessary here
// to ensure that tsc doesn't remove the __NOINLINE__ comment.
// prettier-ignore
export const UNDEFINED = (/*#__NOINLINE__*/ noop()) as undefined
export const IS_REACT_LEGACY = !version.startsWith('18')

// @ts-expect-error TODO: should remove this when the default react version is 18
export const IS_REACT_LEGACY = !React.useId
export const OBJECT = Object

export const isUndefined = (v: any): v is undefined => v === UNDEFINED
Expand Down

0 comments on commit 1f9fbf6

Please sign in to comment.