Suppose you have a comment, and you want to refer to a comment via anchor text, so something like this for example.
This is a permalink to a comment on a post, which demonstrates the objective.
https://stackoverflow.com/a/31079244/7174241
How would you go about setting permalinks for each comment in a list of comments, so you can refer to any comments by a permalink ?
Not sure if this can be done in front end, or this is more of an orm database thing, where setting a unique permalink as per table structure would be more ideal.
So for example you have a comment list component like this
CommentList.js
<Fragment>
{/* filter based on first comment */}
{filterComments.map((comment, i) => (
<div key={i} ref={ref} className="comment">
<CommentItem comment={comment} />
</div>
))}
</Fragment>;
CommentItem.js
<Fragment>
<div id="permalink id goes here ?">
<Link to="/393829fjf"> </Link> ?? // should a link go here
<p>{comment.body}</p>
</div>
</Fragment>;
Similar question but no helpful solution.