{"id":25234188,"url":"https://github.com/basuabhirup/react-todo-list","last_synced_at":"2026-05-05T17:33:42.003Z","repository":{"id":129963493,"uuid":"409278692","full_name":"basuabhirup/react-toDo-list","owner":"basuabhirup","description":"Created with CodeSandbox","archived":false,"fork":false,"pushed_at":"2021-09-23T12:29:07.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T23:37:26.632Z","etag":null,"topics":["javascript","jsx","react-components","react-props","react-state","reactjs"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/github/basuabhirup/react-toDo-list","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basuabhirup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-09-22T16:31:12.000Z","updated_at":"2023-03-08T22:47:54.000Z","dependencies_parsed_at":"2023-05-09T09:46:00.622Z","dependency_job_id":null,"html_url":"https://github.com/basuabhirup/react-toDo-list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/basuabhirup/react-toDo-list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basuabhirup%2Freact-toDo-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basuabhirup%2Freact-toDo-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basuabhirup%2Freact-toDo-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basuabhirup%2Freact-toDo-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basuabhirup","download_url":"https://codeload.github.com/basuabhirup/react-toDo-list/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basuabhirup%2Freact-toDo-list/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32660381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","jsx","react-components","react-props","react-state","reactjs"],"created_at":"2025-02-11T13:58:54.655Z","updated_at":"2026-05-05T17:33:41.998Z","avatar_url":"https://github.com/basuabhirup.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# To-Do List with React\n\n### CodeSandbox Live Site URL: [https://codesandbox.io/s/github/basuabhirup/react-toDo-list](https://codesandbox.io/s/github/basuabhirup/react-toDo-list)\n\nThis project is a part of [The Complete 2021 Web Development Bootcamp](https://www.udemy.com/course/the-complete-web-development-bootcamp/) by [London App Brewery](https://www.londonappbrewery.com/), instructed by Dr. Angela Yu.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://i.ibb.co/cCNS2H5/image.png\" alt=\"Project Screenshot\"\u003e\n\u003c/div\u003e\n\n## Objective of this Project:\n\n- To create a functional To-Do List app from the starting files.\n- When new text is written into the input, its state should be saved.\n- When the add button is pressed, the current data in the input should be added to an array.\n- The `\u003cul\u003e` should display all the array items as `\u003cli\u003e`s.\n\n## Steps I have followed:\n\n1. Created a new state variable `item` using `useState()` react hook to keep track of changes made on the input field.\n\n```javascript\nconst [item, setItem] = useState(\"\");\n\nfunction handleChange(e) {\n  setItem(e.target.value);\n}\n```\n\n```html\n\u003cinput onChange=\"{handleChange}\" type=\"text\" value=\"{item}\" /\u003e\n```\n\n\u003cbr /\u003e\n\n2. Created another state variable `itemsArray` using `useState()` react hook to save the items when the add button is pressed.\n\n```javascript\nconst [itemsArray, setItemsArray] = useState([]);\n\nfunction addItem() {\n  setItemsArray([...itemsArray, item]);\n  setItem(\"\");\n}\n```\n\n```html\n\u003cbutton onClick=\"{addItem}\"\u003e\u003cspan\u003eAdd\u003c/span\u003e\u003c/button\u003e\n```\n\n\u003cbr /\u003e\n\n3. Used `map()` method on the `itemsArray` to render all the items as `\u003cli\u003e`s in the list:\n\n```javascript\n{\n  itemsArray.map((item) =\u003e \u003cli\u003e{item}\u003c/li\u003e);\n}\n```\n\n\u003cbr /\u003e\n\n4. Created two new components - `Input` and `Item` inside `App` for reusability, modularity and a better readability.\n\n5. Modified the code to keep the app functional by managing states and props of all the components:\n\n```javascript\n// Inside 'components/App.jsx'\nfunction addItem(item) {\n  setItemsArray([...itemsArray, item]);\n}\n\n\u003cInput onClick={addItem} /\u003e;\n\n// Inside 'components/Input.jsx'\nfunction Input(props) {\n  const [item, setItem] = useState(\"\");\n\n  function handleChange(e) {\n    setItem(e.target.value);\n  }\n\n  return (\n    \u003cdiv className=\"form\"\u003e\n      \u003cinput onChange={handleChange} type=\"text\" value={item} /\u003e\n      \u003cbutton\n        onClick={() =\u003e {\n          props.onClick(item);\n          setItem(\"\");\n        }}\n      \u003e\n        \u003cspan\u003eAdd\u003c/span\u003e\n      \u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n```javascript\n// Inside 'components/App.jsx'\n\u003cul\u003e\n  {itemsArray.map((item) =\u003e (\n    \u003cItem itemName={item} /\u003e\n  ))}\n\u003c/ul\u003e;\n\n// Inside 'components/Item.jsx'\nfunction Item(props) {\n  return \u003cli\u003e{props.itemName}\u003c/li\u003e;\n}\n```\n\n\u003cbr /\u003e\n\n6. Created a new function `deleteItem` inside `App` component and passed the same to its child `Item` component. Also, passed the correspoding index value to the child component:\n\n```javascript\nfunction deleteItem(id) {\n  setItemsArray((prevValue) =\u003e {\n    return prevValue.filter((item, index) =\u003e {\n      return index !== id;\n    });\n  });\n}\n\n\u003cul\u003e\n  {itemsArray.map((item, index) =\u003e (\n    \u003cItem key={index} id={index} itemName={item} onClick={deleteItem} /\u003e\n  ))}\n\u003c/ul\u003e;\n```\n\n\u003cbr /\u003e\n\n7. Modified the code inside the `Item` component, so that after receiving props it can use them properly to delete an item that gets clicked.\n\n```javascript\nfunction Item(props) {\n  return \u003cli onClick={() =\u003e props.onClick(props.id)}\u003e{props.itemName}\u003c/li\u003e;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasuabhirup%2Freact-todo-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasuabhirup%2Freact-todo-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasuabhirup%2Freact-todo-list/lists"}