Simple CRUD application in React
import React , { useState } from 'react' ; function App () { // Sample initial data const [ items , setItems ] = useState ([ { id : 1 , name : 'Item 1' }, { id : 2 , name : 'Item 2' }, ]); // State to handle input for new items const [ inputValue , setInputValue ] = useState ( '' ); // State to track the item being edited const [ editItemId , setEditItemId ] = useState ( null ); const [ editInputValue , setEditInputValue ] = useState ( '' ); // Create operation: Adding a new item const handleAddItem = () => { if ( inputValue . trim ()) { const newItem = { id : items . length + 1 , // Simple id generator name : inputValue , }; setItems ([ ... items , newItem ]); setInputValue ( '' ); // Reset input fi...