Create a component that allows users to add and remove tags dynamically.
MediumProblem Statement
Create a component that allows users to add and remove tags dynamically.
Sample Input
Initial tags: ["React", "JavaScript"]
Sample Output
Users can add a new tag or remove an existing one by clicking a delete button next to it.
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React, { useState } from "react";
const TagManager = () => {
return (
<div>
<ul>
{/* Render tags */}
</ul>
<input type="text" />
<button>Add Tag</button>
</div>
);
};
export default TagManager;
Input
Initial tags: ["React", "JavaScript"]
Expected Output
Users can add a new tag or remove an existing one by clicking a delete button next to it.