Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad usages of key #29

Open
matthewyu01 opened this issue Jun 11, 2024 · 0 comments
Open

Fix bad usages of key #29

matthewyu01 opened this issue Jun 11, 2024 · 0 comments

Comments

@matthewyu01
Copy link
Member

See https://stackoverflow.com/a/43892905/13112250

Change the use of indices for key to something unique where order will change (altho I think every .map is for a fixed array that won't change)

Fix

<div key={article._id} className="card">
<Box title={article.title} innerText="">
<Markdown className="prose">{article.content}</Markdown>
</Box>
<div className="main-content">
<div className="btn-container">
<Link href={`/${article._id}/edit`}>
<button className="btn edit">Edit</button>
</Link>
<button className="btn delete" onClick={handleDelete}>
Delete
</button>
</div>
</div>
{message && <p>{message}</p>}
</div>
<div key={article._id} className="card">

and any other places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant