Skip to content

Commit

Permalink
chore: router retrieved by hook instead of argument
Browse files Browse the repository at this point in the history
  • Loading branch information
aegroto committed Nov 21, 2024
1 parent 399121d commit 3a8dd86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/recent-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import BootstrapForm from 'react-bootstrap/Form'
import { Select } from './form'
import { useRouter } from 'next/router'

function ActiveBountiesCheckbox ({ router, prefix }) {
function ActiveBountiesCheckbox ({ prefix }) {
const router = useRouter()

const onChange = (e) => {
const url = new URL(prefix + '/recent/bounties', window.location.origin)
if (e.target.checked) {
Expand Down Expand Up @@ -49,7 +51,7 @@ export default function RecentHeader ({ type, sub }) {
noForm
onChange={(_, e) => router.push(prefix + (e.target.value === 'posts' ? '/recent' : `/recent/${e.target.value}`))}
/>
{type === 'bounties' ? <ActiveBountiesCheckbox router={router} prefix={prefix} /> : (null)}
{type === 'bounties' ? <ActiveBountiesCheckbox prefix={prefix} /> : (null)}
</div>
</div>
)
Expand Down

0 comments on commit 3a8dd86

Please sign in to comment.