mirror of
https://github.com/vercel/commerce.git
synced 2025-03-29 16:55:52 +00:00
18 lines
438 B
TypeScript
18 lines
438 B
TypeScript
import { useCallback } from 'react'
|
|
import { HookFetcher, HookFetcherOptions } from '../utils/types'
|
|
import { useCommerce } from '..'
|
|
|
|
export default function useRemoveItem<T, Input>(
|
|
options: HookFetcherOptions,
|
|
fetcher: HookFetcher<T, Input>
|
|
) {
|
|
const { fetcherRef } = useCommerce()
|
|
|
|
return useCallback(
|
|
function removeItem(input: Input) {
|
|
return fetcher(options, input, fetcherRef.current)
|
|
},
|
|
[fetcher]
|
|
)
|
|
}
|