Answer the question
In order to leave comments, you need to log in
How to disable a specific button in react and keep it that way?
How can I disable a certain button and not all, the data comes from the server, there can be a lot of buttons, but you need to disable a certain one and how can you now disable a certain button by clicking on the button and make it so that it is always disabled if the button was pressed?
<div
className="card"
style={{ width: 18 + "rem" }}
key={`${index}`}
>
<img src={post.url} className="card-img-top" alt="..." />
<div className="card-body">
<h5 className="card-title">{post.title}</h5>
<p className="card-text">{post.content}</p>
<a href="/" className="btn btn-primary">
{post.category}
</a>
<button onClick={() => like(index)} disabled >Like</button>
<h3>{post.likes} likes</h3>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question