{"id":32831,"date":"2024-11-01T09:11:51","date_gmt":"2024-11-01T09:11:51","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32831"},"modified":"2024-11-01T11:21:49","modified_gmt":"2024-11-01T11:21:49","slug":"react-course-to-do-app-example-rendering-a-to-do-list","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32831\/","title":{"rendered":"React Course: To Do App Example &#8211; Rendering a To Do List"},"content":{"rendered":"<p><body><\/p>\n<article>\n<header>\n<p>Author: [Your Name]<\/p>\n<p>Date: [Date]<\/p>\n<\/header>\n<section>\n<h2>Introduction<\/h2>\n<p>In recent years, React has become one of the most popular libraries in the field of web development. It is very useful for creating and managing user interfaces, and thanks to its component-based architecture, it enhances code reusability and maintainability. In this article, we will create a simple To Do list application using React. In the first chapter of this tutorial, we will learn how to render a list.<\/p>\n<\/section>\n<section>\n<h2>1. Setting Up the Development Environment<\/h2>\n<p>Before starting development with React, you first need to set up the development environment. Follow the steps below.<\/p>\n<ol>\n<li>\n<strong>Install Node.js:<\/strong><\/p>\n<p>Node.js is required to use React. Download and install the latest version from the <a href=\"https:\/\/nodejs.org\/\">official Node.js site<\/a>.<\/p>\n<\/li>\n<li>\n<strong>Install Create React App:<\/strong><\/p>\n<p>Create React App is a tool that helps you easily start a React project. Open your terminal and enter the following command to install it.<\/p>\n<pre><code>npx create-react-app todo-app<\/code><\/pre>\n<p>Executing this command will create a folder called `todo-app`, and a basic React project will be set up.<\/p>\n<\/li>\n<li>\n<strong>Navigate to Project Folder:<\/strong><\/p>\n<p>Enter the following command to navigate to the project folder.<\/p>\n<pre><code>cd todo-app<\/code><\/pre>\n<\/li>\n<li>\n<strong>Run the Development Server:<\/strong><\/p>\n<p>You can run the development server to check your React application. Enter the following command.<\/p>\n<pre><code>npm start<\/code><\/pre>\n<p>Opening <code>http:\/\/localhost:3000<\/code> in your browser will display the default React application.<\/p>\n<\/li>\n<\/ol>\n<\/section>\n<section>\n<h2>2. Understanding the Basic Structure<\/h2>\n<p>The building blocks of React are components. Each component defines a part of the UI and has state and props.<\/p>\n<p>Now, we will create a component that will render the To Do list.<\/p>\n<\/section>\n<section>\n<h2>3. Creating the To Do Component<\/h2>\n<p>First, create a file named `Todo.js` inside the `src` folder. In this file, we will create a component to render the to-do items.<\/p>\n<pre><code>\n\/\/ Todo.js\nimport React from 'react';\n\nfunction Todo({ todo }) {\n    return (\n        <div classname=\"todo\">\n            <h3>{todo.text}<\/h3>\n            <p>Completion Status: {todo.completed ? 'Completed' : 'Not Completed'}<\/p>\n        <\/div>\n    );\n}\n\nexport default Todo;\n            <\/code><\/pre>\n<p>The code above defines a component called `Todo`. This component receives `todo` as a prop and renders the text and completion status of that item.<\/p>\n<\/section>\n<section>\n<h2>4. Rendering the Todo List<\/h2>\n<p>Now, let&#8217;s create a component that actually renders the to-do list. We will modify the `App.js` file to display the to-do list.<\/p>\n<pre><code>\n\/\/ App.js\nimport React from 'react';\nimport Todo from '.\/Todo';\n\nconst todoList = [\n    { text: 'Learn the basics of React', completed: false },\n    { text: 'Create a React project', completed: false },\n    { text: 'Deploy a React app', completed: true },\n];\n\nfunction App() {\n    return (\n        <div classname=\"App\">\n            <h1>To Do List<\/h1>\n            <div>\n                {todoList.map((todo, index) =&gt; (\n                    <Todo key=\"{index}\" todo=\"{todo}\"><\/Todo>\n                ))}\n            <\/div>\n        <\/div>\n    );\n}\n\nexport default App;\n            <\/code><\/pre>\n<p>In the above code, the `todoList` array stores the list of to-dos to be rendered. Using the `map` method, we render each `todo` item and call the `Todo` component to output the details of that item.<\/p>\n<\/section>\n<section>\n<h2>5. Adding Styles<\/h2>\n<p>To make the application look better, we will add CSS styles. Open the `App.css` file and add the following styles.<\/p>\n<pre><code>\n.todo {\n    border: 1px solid #ccc;\n    padding: 10px;\n    margin: 10px 0;\n    border-radius: 5px;\n    background-color: #f9f9f9;\n}\n\n.App {\n    max-width: 600px;\n    margin: 0 auto;\n    padding: 20px;\n    font-family: Arial, sans-serif;\n}\n\nh1 {\n    text-align: center;\n}\n            <\/code><\/pre>\n<p>The above styles add padding and margin to each to-do item to visually separate them, as well as center alignment and font styling.<\/p>\n<\/section>\n<section>\n<h2>6. Conclusion<\/h2>\n<p>In this tutorial, we created a simple to-do list app using React and learned how to render list items. You now understand the basic React components and how to display data to users using them. Subsequent tutorials will cover state management and additional feature implementations.<\/p>\n<p>The journey of learning React continues. In the next tutorial, we&#8217;ll develop features to add and delete tasks, creating a richer application.<\/p>\n<\/section>\n<footer>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/reactjs.org\/\">Official React Documentation<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\">JavaScript Documentation<\/a><\/li>\n<\/ul>\n<\/footer>\n<\/article>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: [Your Name] Date: [Date] Introduction In recent years, React has become one of the most popular libraries in the field of web development. It is very useful for creating and managing user interfaces, and thanks to its component-based architecture, it enhances code reusability and maintainability. In this article, we will create a simple To &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32831\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;React Course: To Do App Example &#8211; Rendering a To Do List&#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-32831","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 - Rendering a To Do List - \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\/32831\/\" \/>\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 - Rendering a To Do List - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Author: [Your Name] Date: [Date] Introduction In recent years, React has become one of the most popular libraries in the field of web development. It is very useful for creating and managing user interfaces, and thanks to its component-based architecture, it enhances code reusability and maintainability. In this article, we will create a simple To &hellip; \ub354 \ubcf4\uae30 &quot;React Course: To Do App Example &#8211; Rendering a To Do List&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32831\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:11:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:21:49+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=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32831\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32831\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"React Course: To Do App Example &#8211; Rendering a To Do List\",\"datePublished\":\"2024-11-01T09:11:51+00:00\",\"dateModified\":\"2024-11-01T11:21:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32831\/\"},\"wordCount\":498,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"React basics course\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32831\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32831\/\",\"name\":\"React Course: To Do App Example - Rendering a To Do List - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:11:51+00:00\",\"dateModified\":\"2024-11-01T11:21:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32831\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32831\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32831\/#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 &#8211; Rendering a To Do List\"}]},{\"@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 - Rendering a To Do List - \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\/32831\/","og_locale":"ko_KR","og_type":"article","og_title":"React Course: To Do App Example - Rendering a To Do List - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Author: [Your Name] Date: [Date] Introduction In recent years, React has become one of the most popular libraries in the field of web development. It is very useful for creating and managing user interfaces, and thanks to its component-based architecture, it enhances code reusability and maintainability. In this article, we will create a simple To &hellip; \ub354 \ubcf4\uae30 \"React Course: To Do App Example &#8211; Rendering a To Do List\"","og_url":"https:\/\/atmokpo.com\/w\/32831\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:11:51+00:00","article_modified_time":"2024-11-01T11:21:49+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":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32831\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32831\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"React Course: To Do App Example &#8211; Rendering a To Do List","datePublished":"2024-11-01T09:11:51+00:00","dateModified":"2024-11-01T11:21:49+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32831\/"},"wordCount":498,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["React basics course"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32831\/","url":"https:\/\/atmokpo.com\/w\/32831\/","name":"React Course: To Do App Example - Rendering a To Do List - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:11:51+00:00","dateModified":"2024-11-01T11:21:49+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32831\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32831\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32831\/#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 &#8211; Rendering a To Do List"}]},{"@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\/32831","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=32831"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32831\/revisions"}],"predecessor-version":[{"id":32832,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32831\/revisions\/32832"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}