Etika49
Etika49

Reputation: 742

React.js user conversation UI design

I am planning on designing a new discussion UI in React where users should be able to post a comment and reply to a specific comment.

I use a NoSQL key-value based DB - DynamoDB. However, I am not sure how to design the database so that I can render the sub comments in React. In other words how to bind a comment to a sub comment and enable users to reply to each other?

So far i have decided that i will register to the DB the following:

try {
      const id = "randomUUID";

      await addComment({ id, username, comment });
    } catch {
      alert(`something went wrong!!!`);
    }

also a sandbox link to a short draft of my ideas:

https://codesandbox.io/s/ecstatic-lamarr-3iv0c?file=/src/Discussion.js

Upvotes: 0

Views: 90

Answers (1)

Seth Geoghegan
Seth Geoghegan

Reputation: 5747

The DynamoDB documentation has an example Forum application. The example has table definitions, sample data and instructions on how to replicate the application in your own environment. Among other things, it models Forums, Threads and Replies.

You may want to take a look at how they've designed their application and see if it applies to your access patterns.

Upvotes: 1

Related Questions