Programming Exercises

Create a component that allows users to add and remove tags dynamically.

Medium

Problem 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;
Log in or sign up to run or submit your code.Log inSign up
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.