{"id":32833,"date":"2024-11-01T09:11:52","date_gmt":"2024-11-01T09:11:52","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32833"},"modified":"2024-11-01T11:21:48","modified_gmt":"2024-11-01T11:21:48","slug":"react-course-to-do-app-example-implementing-ui","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32833\/","title":{"rendered":"React Course: To Do App Example, Implementing UI"},"content":{"rendered":"<p><body><\/p>\n<p>Hello. In this article, we will learn how to create a To Do app using React. This tutorial will cover both UI\/UX design and functionality implementation. React is a component-based JavaScript library that helps create dynamic user interfaces easily.<\/p>\n<h2>Preparing the Project<\/h2>\n<p>Before we start, we need to set up the basic configuration of the project. You can build the development environment with the following steps.<\/p>\n<pre><code>npx create-react-app my-todo-app<\/code><\/pre>\n<p>Running the above command will create the basic template of a React app in a folder named <code>my-todo-app<\/code>. Let&#8217;s navigate to the created folder and run the app.<\/p>\n<pre><code>cd my-todo-app\nnpm start<\/code><\/pre>\n<p>If you access <code>http:\/\/localhost:3000<\/code> in your browser, you will see the basic React app running.<\/p>\n<h2>Designing Component Structure<\/h2>\n<p>The basic functionality of the To Do app is to add tasks, toggle completion status, and delete them. You can design the component structure as follows.<\/p>\n<ul>\n<li><strong>App<\/strong>: The root component of the application<\/li>\n<li><strong>TodoList<\/strong>: The component that displays the list of tasks<\/li>\n<li><strong>TodoItem<\/strong>: The component that displays each task item<\/li>\n<li><strong>AddTodo<\/strong>: The form component for adding a task<\/li>\n<\/ul>\n<h2>Implementing Components<\/h2>\n<p>Now let&#8217;s implement each component.<\/p>\n<h3>1. App Component<\/h3>\n<p>First, let&#8217;s open the <code>App.js<\/code> file and define the basic state.<\/p>\n<pre><code>import React, { useState } from 'react';\nimport TodoList from '.\/components\/TodoList';\nimport AddTodo from '.\/components\/AddTodo';\n\nconst App = () =&gt; {\n    const [todos, setTodos] = useState([]);\n\n    const addTodo = (todo) =&gt; {\n        setTodos([...todos, todo]);\n    };\n\n    const toggleComplete = (index) =&gt; {\n        const newTodos = todos.map((todo, i) =&gt; {\n            if (i === index) {\n                return { ...todo, completed: !todo.completed };\n            }\n            return todo;\n        });\n        setTodos(newTodos);\n    };\n\n    const deleteTodo = (index) =&gt; {\n        const newTodos = todos.filter((_, i) =&gt; i !== index);\n        setTodos(newTodos);\n    };\n\n    return (\n        &lt;div className=\"App\"&gt;\n            &lt;h1&gt;To Do List&lt;\/h1&gt;\n            &lt;AddTodo addTodo={addTodo} \/&gt;\n            &lt;TodoList todos={todos} toggleComplete={toggleComplete} deleteTodo={deleteTodo} \/&gt;\n        &lt;\/div&gt;\n    );\n};\n\nexport default App;<\/code><\/pre>\n<h3>2. TodoList Component<\/h3>\n<p>Next, we will implement <code>TodoList.js<\/code>. This component renders the list of tasks.<\/p>\n<pre><code>import React from 'react';\nimport TodoItem from '.\/TodoItem';\n\nconst TodoList = ({ todos, toggleComplete, deleteTodo }) =&gt; {\n    return (\n        &lt;ul&gt;\n            {todos.map((todo, index) =&gt; (\n                &lt;TodoItem \n                    key={index} \n                    todo={todo} \n                    toggleComplete={() =&gt; toggleComplete(index)} \n                    deleteTodo={() =&gt; deleteTodo(index)} \n                \/&gt;\n            ))}\n        &lt;\/ul&gt;\n    );\n};\n\nexport default TodoList;<\/code><\/pre>\n<h3>3. TodoItem Component<\/h3>\n<p>Now, let&#8217;s create <code>TodoItem.js<\/code> to represent each task item.<\/p>\n<pre><code>import React from 'react';\n\nconst TodoItem = ({ todo, toggleComplete, deleteTodo }) =&gt; {\n    return (\n        &lt;li style={{ textDecoration: todo.completed ? 'line-through' : 'none' }}&gt;\n            {todo.text}\n            &lt;button onClick={toggleComplete}&gt;Complete&lt;\/button&gt;\n            &lt;button onClick={deleteTodo}&gt;Delete&lt;\/button&gt;\n        &lt;\/li&gt;\n    );\n};\n\nexport default TodoItem;<\/code><\/pre>\n<h3>4. AddTodo Component<\/h3>\n<p>Finally, let&#8217;s implement the form for adding tasks.<\/p>\n<pre><code>import React, { useState } from 'react';\n\nconst AddTodo = ({ addTodo }) =&gt; {\n    const [inputValue, setInputValue] = useState('');\n\n    const handleSubmit = (e) =&gt; {\n        e.preventDefault();\n        if (inputValue.trim()) {\n            addTodo({ text: inputValue, completed: false });\n            setInputValue('');\n        }\n    };\n\n    return (\n        &lt;form onSubmit={handleSubmit}&gt;\n            &lt;input \n                type=\"text\" \n                value={inputValue} \n                onChange={(e) =&gt; setInputValue(e.target.value)} \n                placeholder=\"Enter your task\" \n            \/&gt;\n            &lt;button type=\"submit\"&gt;Add&lt;\/button&gt;\n        &lt;\/form&gt;\n    );\n};\n\nexport default AddTodo;<\/code><\/pre>\n<h2>Adding Styling<\/h2>\n<p>Now that the basic functionality has been implemented, let&#8217;s make the UI more beautiful using CSS. Add the following styles to the <code>App.css<\/code> file.<\/p>\n<pre><code>body {\n    font-family: 'Arial', sans-serif;\n    background-color: #f4f4f4;\n}\n\n.App {\n    max-width: 600px;\n    margin: 50px auto;\n    padding: 20px;\n    background: white;\n    border-radius: 8px;\n    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n}\n\nh1 {\n    text-align: center;\n}\n\nform {\n    display: flex;\n    justify-content: space-between;\n    margin-bottom: 20px;\n}\n\ninput[type=\"text\"] {\n    flex: 1;\n    padding: 10px;\n    border: 1px solid #ccc;\n    border-radius: 4px;\n}\n\nbutton {\n    padding: 10px 15px;\n    margin-left: 10px;\n    border: none;\n    border-radius: 4px;\n    background: #4A90E2;\n    color: white;\n    cursor: pointer;\n}\n\nbutton:hover {\n    background: #357ABD;\n}\n\nul {\n    list-style-type: none;\n    padding: 0;\n}<\/code><\/pre>\n<h2>Testing and Deployment<\/h2>\n<p>Now that the app is complete, you can proceed to test and deploy it. You can create a production build using the command npm run build.<\/p>\n<pre><code>npm run build<\/code><\/pre>\n<p>Deploy the generated <code>build<\/code> folder to a server, and your To Do app will be showcased to the world.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this tutorial, we implemented a basic To Do app using React. We effectively built the UI using React&#8217;s component-based architecture and state management. Next, I recommend trying to add more complex features or using a state management library like Redux.<\/p>\n<p>Developing projects with React is a process of iteration and improvement. Keep learning and practicing to create your own amazing applications!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello. In this article, we will learn how to create a To Do app using React. This tutorial will cover both UI\/UX design and functionality implementation. React is a component-based JavaScript library that helps create dynamic user interfaces easily. Preparing the Project Before we start, we need to set up the basic configuration of the &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32833\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;React Course: To Do App Example, Implementing UI&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[123],"tags":[],"class_list":["post-32833","post","type-post","status-publish","format-standard","hentry","category-react-basics-course"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>React Course: To Do App Example, Implementing UI - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/32833\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React Course: To Do App Example, Implementing UI - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Hello. In this article, we will learn how to create a To Do app using React. This tutorial will cover both UI\/UX design and functionality implementation. React is a component-based JavaScript library that helps create dynamic user interfaces easily. Preparing the Project Before we start, we need to set up the basic configuration of the &hellip; \ub354 \ubcf4\uae30 &quot;React Course: To Do App Example, Implementing UI&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32833\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:11:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:21:48+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"4\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32833\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32833\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"React Course: To Do App Example, Implementing UI\",\"datePublished\":\"2024-11-01T09:11:52+00:00\",\"dateModified\":\"2024-11-01T11:21:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32833\/\"},\"wordCount\":371,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"React basics course\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32833\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32833\/\",\"name\":\"React Course: To Do App Example, Implementing UI - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:11:52+00:00\",\"dateModified\":\"2024-11-01T11:21:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32833\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32833\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32833\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"React Course: To Do App Example, Implementing UI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"React Course: To Do App Example, Implementing UI - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/32833\/","og_locale":"ko_KR","og_type":"article","og_title":"React Course: To Do App Example, Implementing UI - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Hello. In this article, we will learn how to create a To Do app using React. This tutorial will cover both UI\/UX design and functionality implementation. React is a component-based JavaScript library that helps create dynamic user interfaces easily. Preparing the Project Before we start, we need to set up the basic configuration of the &hellip; \ub354 \ubcf4\uae30 \"React Course: To Do App Example, Implementing UI\"","og_url":"https:\/\/atmokpo.com\/w\/32833\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:11:52+00:00","article_modified_time":"2024-11-01T11:21:48+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"4\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32833\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32833\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"React Course: To Do App Example, Implementing UI","datePublished":"2024-11-01T09:11:52+00:00","dateModified":"2024-11-01T11:21:48+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32833\/"},"wordCount":371,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["React basics course"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32833\/","url":"https:\/\/atmokpo.com\/w\/32833\/","name":"React Course: To Do App Example, Implementing UI - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:11:52+00:00","dateModified":"2024-11-01T11:21:48+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32833\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32833\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32833\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"React Course: To Do App Example, Implementing UI"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=32833"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32833\/revisions"}],"predecessor-version":[{"id":32834,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32833\/revisions\/32834"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}