# Get feed

```jsx
import {Virtuoso} from 'react-virtuoso'
const topAllCommunities = [
  {name: 'memes.eth', publicKey: '12D3KooWMemes...'},
  {publicKey: '12D3KooWNews...'},
  {publicKey: '12D3KooWTech...'},
]
const {feed, hasMore, loadMore} = useFeed({communities: topAllCommunities, sortType: 'topAll'})

<Virtuoso
  data={feed}
  itemContent={(index, post) => <Post index={index} post={post}/>}
  useWindowScroll={true}
  components={{Footer: hasMore ? () => <Loading/> : undefined}}
  endReached={loadMore}
  increaseViewportBy={{bottom: 600, top: 600}}
/>

// you probably will want to buffer some feeds in the background so they are already loaded
// when you need them
useBufferedFeeds({
  feedsOptions: [
    {communities: [{name: 'news.eth'}, {name: 'crypto.eth'}], sortType: 'new'},
    {communities: [{name: 'memes.eth', publicKey: '12D3KooWMemes...'}], sortType: 'topWeek'},
    {communities: [{publicKey: '12D3KooW...'}, {publicKey: '12D3KooW...'}, {publicKey: '12D3KooW...'}, {publicKey: '12D3KooW...'}], sortType: 'hot'}
  ]
})

// search a feed
const createSearchFilter = (searchTerm) => ({
  filter: (comment) => comment.title?.includes(searchTerm) || comment.content?.includes(searchTerm),
  key: `includes-${searchTerm}` // required key to cache the filter
})
const searchFilter = createSearchFilter('bitcoin')
const searchedCommunities = communityAddresses.map((communityAddress) => ({ name: communityAddress }))
const {feed, hasMore, loadMore} = useFeed({communities: searchedCommunities, filter: searchFilter})

// image only feed
const imageOnlyFilter = {
  filter: (comment) => getCommentLinkMediaType(comment?.link) === 'image',
  key: 'image-only' // required key to cache the filter
}
const {feed, hasMore, loadMore} = useFeed({
  communities: searchedCommunities,
  filter: imageOnlyFilter,
})

// widen a freshness window without replacing the current feed instance
const {feed, expandTimeWindow} = useFeed({
  communities: [{name: 'news.eth'}],
  sortType: 'active',
  newerThan: 60 * 60 * 24,
})

await expandTimeWindow(60 * 60 * 24 * 7)
```
