Skip to content

Commit

Permalink
Clarified import and FC usage in README.md example
Browse files Browse the repository at this point in the history
A couple of things to note:
* You don't have to provide the `{}` type for react function components, as it defaults to nothing
* It's not clear whether `useHotkeys` is intended to be a default export or named, so I added it as named

Thanks for this package by the way. Super useful!
  • Loading branch information
Josh Goldberg authored Aug 21, 2019
1 parent 1a5408a commit 2609757
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Make sure that you have at least version 16.8 of `react` and `react-dom` install
### Usage
With TypeScript
```typescript jsx
export const ExampleComponent: React.FunctionComponent<{}> = () => {
import { useHotkeys } from 'react-hotkeys-hook';

export const ExampleComponent: React.FC = () => {
const [count, setCount] = useState(0);
useHotkeys('ctrl+k', () => setCount(prevCount => prevCount + 1));

Expand Down

0 comments on commit 2609757

Please # to comment.