Skip to content

Commit

Permalink
[@mantine/hooks] use-id: replace with useIsomorphicEffect hooks (#2097
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ryuhangyeong committed Aug 13, 2022
1 parent bc711ee commit d52e46f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/mantine-hooks/src/use-id/use-id.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useState, useEffect, useLayoutEffect } from 'react';
import React, { useState } from 'react';
import { useIsomorphicEffect } from '../use-isomorphic-effect/use-isomorphic-effect';

const randomId = () => `mantine-${Math.random().toString(36).slice(2, 11)}`;

const useIsomorphicEffect = typeof document !== 'undefined' ? useLayoutEffect : useEffect;

const useReactId: () => string | undefined =
(React as any)['useId'.toString()] || (() => undefined);

Expand Down

0 comments on commit d52e46f

Please sign in to comment.