Skip to content

Commit

Permalink
remove setKey
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxsan committed Jul 21, 2021
1 parent 16b2ef9 commit d2d87ce
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/docsearch-react/src/DocSearchButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';

import { ControlKeyIcon } from './icons/ControlKeyIcon';
import { SearchIcon } from './icons/SearchIcon';
Expand All @@ -25,15 +25,14 @@ export const DocSearchButton = React.forwardRef<
>(({ translations = {}, ...props }, ref) => {
const { buttonText = 'Search', buttonAriaLabel = 'Search' } = translations;

const [key, setKey] = useState<
const [key] = useState<
typeof ACTION_KEY_APPLE | typeof ACTION_KEY_DEFAULT | null
>(null);

useEffect(() => {
>(() => {
if (typeof navigator !== 'undefined') {
setKey(isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT);
return isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT;
}
}, []);
return null;
});

return (
<button
Expand Down

0 comments on commit d2d87ce

Please sign in to comment.