Feed Display

Display public channel feeds with pagination, interactive posts, and channel switching using the Deva SDK.


What You'll Build

A React application demonstrating:

  • ChannelFeed component displaying posts from channels

  • Channel selector to switch between different channels

  • Authentication flow with login requirement

  • Cursor-based pagination (20 posts per page)

  • Load more functionality for seamless browsing

  • Responsive layout for all screen sizes


Example Structure

example-feed-display/
├── src/
│   ├── App.tsx         # Main app with DevaProvider and FeedApp
│   ├── main.tsx        # App entry point
│   └── index.css       # Global styles
└── package.json

Routes

This is a single-page application with no routing:

  • / - Feed display (requires authentication)


Code for Each Part

App.tsx - Complete Application


Setup & Installation

Prerequisites

Get Deva Credentials

  1. Visit deva.mearrow-up-right and sign in

  2. Go to Settings → Apps

  3. Click Create New Application

  4. Fill in:

    • Name: Feed Display Example

    • Redirect URIs: http://localhost:5175

    • Origin URIs: http://localhost:5175

  5. Copy your Client ID

Install and Run

Open http://localhost:5175 in your browser.

Test the App

  1. Click Sign in button

  2. Authenticate with your Deva account

  3. View posts in the Eliza channel (default)

  4. Switch channels:

    • 📢 Eliza - Public channel with posts from Eliza

    • 👤 Your Channel - Your personal channel (handle = your username)

    • ❌ 404 - Non-existent channel (shows empty state)

  5. Scroll down and click Load More to see additional posts


Notes

  • ChannelFeed requires authentication to load posts

  • Pagination is cursor-based with 20 posts per page

  • Each channel maintains its own pagination state

  • Channel handle equals the user's username (e.g., username "johndoe" → channel handle "johndoe")

  • Default channel is "eliza" - a public channel

  • The component handles all loading and error states internally

  • Changing the handle prop resets pagination and loads the new channel


Last updated