mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
14 lines
320 B
TypeScript
14 lines
320 B
TypeScript
import * as React from 'react'
|
|
import * as DOMHelper from 'utils/DOMHelper'
|
|
|
|
type Props<P> = {
|
|
to: string
|
|
children: React.ReactElement<P>
|
|
}
|
|
|
|
export function PJAXLink<P>({ to, children }: Props<P>) {
|
|
return React.cloneElement(children, {
|
|
...children.props,
|
|
onClick: () => DOMHelper.loadWithPJAX(to),
|
|
})
|
|
}
|