Skip to main content

Function: useFetchPosts()

useFetchPosts<T, P>(params, options, path, fetcher): usePostsResponse<T>

Defined in: packages/core/src/react/hooks/useFetchPosts.ts:42

The useFetchPosts hook. Returns a collection of post entities

See usePosts for usage instructions.

Type Parameters

T

T extends PostEntity = PostEntity

P

P extends PostsArchiveParams = PostsArchiveParams

Parameters

params

The list of params to pass to the fetch strategy. It overrides the ones in the URL.

{ } | P

options

FetchHookOptions<FetchResponse<T[]>> = {}

The options to pass to the swr hook.

path

string = ''

The path of the url to get url params from.

fetcher

The fetch strategy to use. If none is passed, the default one is used

undefined | PostsArchiveFetchStrategy<T, P>

Returns

usePostsResponse<T>