Skip to content

Commit

Permalink
fix: useCallback for GitHub link onClick (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoRmalka authored Dec 26, 2023
1 parent ee8a31d commit 90b650e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/layout/sidebar/GitHubLink/GitHubLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GithubOutlined } from '@ant-design/icons'
import { useTranslation } from 'react-i18next'
import { useCallback } from 'react'
import './GitHubLink.scss'

export default function GitHubLink() {
Expand All @@ -12,9 +13,9 @@ export default function GitHubLink() {
element: null,
}

const handleClick = () => {
const handleClick = useCallback(() => {
window.open(data.path, '_blank')
}
}, [])

return (
<div className="github-link" onClick={handleClick}>
Expand Down

0 comments on commit 90b650e

Please sign in to comment.