Constructor
Components
LoadMoreCollectionStories
<LoadMoreCollectionStories />
This component is very similar to the LoadMoreBase component but fetches the stories from a collection
. The api call /api/v1/collections/{collectionSlug}
is made with the passed collection slug value. The component accepts the params
prop and a requires a Collection Slug from which to fetch the stories and returns a set of stories only.
import { LoadMoreCollectionStories } from '@quintype/components';
function MoreCollectionStories({collection, stories, loading, onLoadMore, noMoreStories}) {
return <div/>;
}
export function HomePage(props) {
return <LoadMoreCollectionStories template={MoreCollectionStories}
collectionSlug={props.data.collectionSlug}
data={{collection: collection, stories: initialStories}}
params={{}}/>
}
Get Collection of stories written by a particular author
We can get the collection of stories written by a specific author by using the authorId prop as below:
export function HomePage(props) {
return <LoadMoreCollectionStories
template={MoreCollectionStories}
data={{stories: stories}}
authorId={props.author.id}
params={{}}
numStoriesToLoad={10} />
}
Also see LoadMoreStoriesBase for a version that takes a section id instead of a collection