Function: usePost()
usePost<
T,P>(params,options):usePostResponse<T>
Defined in: packages/next/src/data/hooks/usePost.ts:18
The usePost hook. Returns a single post entity
In order to automatically map URL params create a catch-all route named [...path].js.
You can create the catch-all at any level e.g: pages/[...path].js, pages/blog/[...path].js, etc.
The pages/[...path].js route for instance would yield a URL like this: /post-slug, /2020/01/01/post-slug, etc.
Type Parameters
T
T extends PostEntity = PostEntity
P
P extends PostParams = PostParams
Parameters
params
Partial<P> = {}
The parameters accepted by the hook
options
FetchHookOptions<FetchResponse<T>> = {}
Options for the SWR configuration