{"id":32931,"date":"2024-11-01T09:12:33","date_gmt":"2024-11-01T09:12:33","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32931"},"modified":"2024-11-01T11:21:25","modified_gmt":"2024-11-01T11:21:25","slug":"react-course-diary-app-example-preparing-for-the-project","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32931\/","title":{"rendered":"React Course: Diary App Example, Preparing for the Project"},"content":{"rendered":"<p><body><\/p>\n<article>\n<p>React is a JavaScript library for building user interfaces, helping developers create web applications more efficiently and intuitively. In this course, we will learn the basic concepts of React by creating a simple diary application, and we will detail the process of preparing for an actual project.<\/p>\n<h2>1. What is React?<\/h2>\n<p>React is a library that enables the development of declarative and component-based web applications. Developed by Facebook, it is now used by many companies and developers. The main advantages of React are as follows:<\/p>\n<ul>\n<li><strong>Reusable Components:<\/strong> React allows developers to break the UI into smaller units called components. These components can easily be reused in different places.<\/li>\n<li><strong>Virtual DOM:<\/strong> React uses a Virtual DOM to minimize actual DOM manipulations. This greatly enhances performance.<\/li>\n<li><strong>One-way Data Flow:<\/strong> Since data flows in one direction only, it makes predicting the state of data easier and code maintenance more manageable.<\/li>\n<\/ul>\n<h2>2. Overview of the Diary App Project<\/h2>\n<p>In this project, we will create a simple diary application that allows users to write, view, and delete diary entries. The basic functionalities are as follows:<\/p>\n<ul>\n<li>View diary list<\/li>\n<li>Write a new diary entry<\/li>\n<li>Delete diary entries<\/li>\n<\/ul>\n<p>To implement these functionalities, we will learn about React&#8217;s state management and the way data is passed between components.<\/p>\n<h2>3. Setting Up the Development Environment<\/h2>\n<p>Before starting the project, we need to set up the React development environment. The following tools need to be installed:<\/p>\n<ul>\n<li><strong>Node.js:<\/strong> A server-side JavaScript runtime used to run and manage React applications.<\/li>\n<li><strong>npm or yarn:<\/strong> JavaScript package managers used to install React-related libraries.<\/li>\n<li><strong>Code Editor:<\/strong> Choose an editor for coding tasks, such as VSCode or Atom.<\/li>\n<\/ul>\n<p>If Node.js is installed, use the following command to create a project with create-react-app:<\/p>\n<pre><code>npx create-react-app diary-app<\/code><\/pre>\n<p>When the command is executed, a folder named <strong>diary-app<\/strong> will be created, and the basic React structure will be set up. Move to the created folder and run the development server:<\/p>\n<pre><code>cd diary-app<\/code><\/pre>\n<pre><code>npm start<\/code><\/pre>\n<p>Opening <a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a> in a browser will show the default page.<\/p>\n<h2>4. Designing the Component Structure<\/h2>\n<p>The app&#8217;s component structure will be designed as follows:<\/p>\n<pre><code>\n    - App\n        - DiaryList\n        - DiaryForm\n<\/code><\/pre>\n<p>The <strong>App<\/strong> component is the top-level component that manages the state. The <strong>DiaryList<\/strong> component displays the list of diary entries, and the <strong>DiaryForm<\/strong> component provides a form for writing a new diary entry.<\/p>\n<h2>5. Managing State<\/h2>\n<p>In React components, state is a way to manage the data of a component. We will use the useState hook to manage diary data in the <strong>App<\/strong> component. For example, we can set the initial state to an empty array:<\/p>\n<pre><code>\nimport React, { useState } from 'react';\n\nconst App = () => {\n    const [diaries, setDiaries] = useState([]);\n    return (\n        <div>\n            {\/* Components *\/}\n        <\/div>\n    );\n};\n<\/code><\/pre>\n<h2>6. Implementing the Diary Entry Form<\/h2>\n<p>We will create the <strong>DiaryForm<\/strong> component to allow users to write diary entries. We will create an input tag to handle user input and manage the input value using the useState hook:<\/p>\n<pre><code>\nconst DiaryForm = ({ onAdd }) => {\n    const [text, setText] = useState('');\n\n    const handleSubmit = (e) => {\n        e.preventDefault();\n        onAdd(text);\n        setText('');\n    };\n\n    return (\n        <form onSubmit=\"{handleSubmit}\">\n            <input onChange=\"{(e) => setText(e.target.value)}\" type=\"text\" value=\"{text}\" placeholder=\"Write your diary\"\/>\n            <button type=\"submit\">Add<\/button>\n        <\/form>\n    );\n};\n<\/code><\/pre>\n<h2>7. Displaying the Diary List<\/h2>\n<p>We will create the <strong>DiaryList<\/strong> component to display the list of diary entries that have been added. The entries will be rendered using the map function:<\/p>\n<pre><code>\nconst DiaryList = ({ diaries, onDelete }) => {\n    return (\n        <ul>\n            {diaries.map((diary, index) => (\n                <li key=\"{index}\">\n                    {diary}\n                    <button onClick=\"{() => onDelete(index)}\">Delete<\/button>\n                <\/li>\n            ))}\n        <\/ul>\n    );\n};\n<\/code><\/pre>\n<h2>8. Integrating into the App Component<\/h2>\n<p>Now we will integrate each component into the App component and connect the functionalities for adding and deleting diary entries:<\/p>\n<pre><code>\nconst App = () => {\n    const [diaries, setDiaries] = useState([]);\n\n    const addDiary = (text) => {\n        setDiaries([...diaries, text]);\n    };\n\n    const deleteDiary = (index) => {\n        setDiaries(diaries.filter((_, i) => i !== index));\n    };\n\n    return (\n        <div>\n            <DiaryForm onAdd=\"{addDiary}\"><\/DiaryForm>\n            <DiaryList diaries=\"{diaries}\" onDelete=\"{deleteDiary}\"><\/DiaryList>\n        <\/div>\n    );\n};\n<\/code><\/pre>\n<h2>9. CSS Styling<\/h2>\n<p>To make the diary app more visually appealing, we can add CSS styles. Create a src\/App.css file to set up basic styles:<\/p>\n<pre><code>\nbody {\n    font-family: Arial, sans-serif;\n}\n\nform {\n    margin-bottom: 20px;\n}\n\ninput {\n    margin-right: 10px;\n    padding: 5px;\n}\n\nbutton {\n    padding: 5px 10px;\n}\n<\/code><\/pre>\n<p>Now when you refresh the app, you will see the diary app with basic styles applied.<\/p>\n<h2>10. Additional Considerations<\/h2>\n<p>This course only covers basic functionality, but you may consider adding the following features while actually working on the project:<\/p>\n<ul>\n<li>Recording the date and time of diary entries<\/li>\n<li>Adding editing functionality for diary entries<\/li>\n<li>Implementing user authentication<\/li>\n<li>Communicating with a server (REST API)<\/li>\n<\/ul>\n<h2>11. Project Deployment<\/h2>\n<p>Once the project is complete, you can deploy it to the web to use the app in a real environment. You can easily deploy using services like Vercel or Netlify. First, I will explain the process of building and deploying the app.<\/p>\n<pre><code>npm run build<\/code><\/pre>\n<p>When the command is executed, a build folder will be created, and the files inside this folder will be the ones actually deployed. You just need to upload these files to Vercel or Netlify for deployment.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this course, we explored the process of developing a diary app using React. We looked at the basic component structure design, state management, styling, and deployment process. While working on real projects, you will be able to deepen your understanding of React by adding your own features. We hope you will continue to explore and develop more React functionalities!<\/p>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/reactjs.org\/docs\/getting-started.html\" target=\"_blank\" rel=\"noopener\">Official React Documentation<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\" target=\"_blank\" rel=\"noopener\">JavaScript MDN Documentation<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/facebook\/react\" target=\"_blank\" rel=\"noopener\">React GitHub Repository<\/a><\/li>\n<\/ul>\n<\/article>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>React is a JavaScript library for building user interfaces, helping developers create web applications more efficiently and intuitively. In this course, we will learn the basic concepts of React by creating a simple diary application, and we will detail the process of preparing for an actual project. 1. What is React? React is a library &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32931\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;React Course: Diary App Example, Preparing for the Project&#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-32931","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: Diary App Example, Preparing for the Project - \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\/32931\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React Course: Diary App Example, Preparing for the Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"React is a JavaScript library for building user interfaces, helping developers create web applications more efficiently and intuitively. In this course, we will learn the basic concepts of React by creating a simple diary application, and we will detail the process of preparing for an actual project. 1. What is React? React is a library &hellip; \ub354 \ubcf4\uae30 &quot;React Course: Diary App Example, Preparing for the Project&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32931\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:12:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:21:25+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\/32931\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32931\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"React Course: Diary App Example, Preparing for the Project\",\"datePublished\":\"2024-11-01T09:12:33+00:00\",\"dateModified\":\"2024-11-01T11:21:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32931\/\"},\"wordCount\":756,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"React basics course\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32931\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32931\/\",\"name\":\"React Course: Diary App Example, Preparing for the Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:12:33+00:00\",\"dateModified\":\"2024-11-01T11:21:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32931\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32931\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32931\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"React Course: Diary App Example, Preparing for the Project\"}]},{\"@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: Diary App Example, Preparing for the Project - \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\/32931\/","og_locale":"ko_KR","og_type":"article","og_title":"React Course: Diary App Example, Preparing for the Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"React is a JavaScript library for building user interfaces, helping developers create web applications more efficiently and intuitively. In this course, we will learn the basic concepts of React by creating a simple diary application, and we will detail the process of preparing for an actual project. 1. What is React? React is a library &hellip; \ub354 \ubcf4\uae30 \"React Course: Diary App Example, Preparing for the Project\"","og_url":"https:\/\/atmokpo.com\/w\/32931\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:12:33+00:00","article_modified_time":"2024-11-01T11:21:25+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\/32931\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32931\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"React Course: Diary App Example, Preparing for the Project","datePublished":"2024-11-01T09:12:33+00:00","dateModified":"2024-11-01T11:21:25+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32931\/"},"wordCount":756,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["React basics course"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32931\/","url":"https:\/\/atmokpo.com\/w\/32931\/","name":"React Course: Diary App Example, Preparing for the Project - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:12:33+00:00","dateModified":"2024-11-01T11:21:25+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32931\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32931\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32931\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"React Course: Diary App Example, Preparing for the Project"}]},{"@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\/32931","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=32931"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32931\/revisions"}],"predecessor-version":[{"id":32932,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32931\/revisions\/32932"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}