Skip to content

Commit

Permalink
Merge pull request #14 from faceless-ui/chore/nanoid
Browse files Browse the repository at this point in the history
feat: implements useId hook
  • Loading branch information
jacobsfletch authored Oct 5, 2022
2 parents 276270f + e1da97d commit d667be7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/SliderProvider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {
useEffect,
useId,
useReducer,
useRef,
useState,
Expand All @@ -12,7 +13,6 @@ import { useBreakpoints } from './useBreakpoints';
import { useMarquee } from './useMarquee';
import { useAutoplay } from './useAutoplay';
import { useScrollToIndex } from './useScrollToIndex';
import { makeID } from '../makeID';

export type ChildFunction = (context: ISliderContext) => React.ReactNode; // eslint-disable-line no-unused-vars

Expand Down Expand Up @@ -53,11 +53,8 @@ const SliderProvider: React.FC<SliderProviderProps> = (props) => {
} = props;

// NOTE: the 'aria-controls' attribute relies on this matching IDs
const [id, setID] = useState(() => idFromProps || makeID(5));

useEffect(() => {
setID(idFromProps || makeID(5));
}, [idFromProps])
const uniqueID = useId();
const id = idFromProps || uniqueID;

const settings = useBreakpoints(props);

Expand Down
15 changes: 0 additions & 15 deletions src/makeID.ts

This file was deleted.

0 comments on commit d667be7

Please sign in to comment.