How do I learn Reactjs part 1 ? Make Todo list mini-app

Tram Ho

Hello friends, my name is Kiet, if you see this post, then thank you for taking the time to read this post of mine.

Foreword:

Currently I am a Vuejs developer, like every other developer, we always have the goal to move forward and learn more about cool things, so I want to share my process of learning React and also practicing more skills. my writing , if my article is good , then i will be happy to help you , let ‘s start

Table of contents :

  1. What preparation?
  2. Technology App
  3. Todolist

1. What to prepare for the start?

We must first determine our own learning path to avoid wandering and not having specific goals

  • Here I choose the route of learning through project work and then summarizing (This has the disadvantage that we will not understand all the React docs, but if we have any problems, we will search in the process)

2.App Technology: (This is just an estimate and will be added as needed)

  • TypeScript language : We will choose Typescript lun from the beginning so that we can reuse this template later to avoid conversion and it is also easy to use, not too difficult, just do it and learn it at the same time.
  • MUI (intended) : I plan to use UI Framework mui-react-component-library.jpg

3. Mini app Todolist :

  • PREPARATION: First I will create an RP template aka basecode in the process that I will put together the necessary things through the projects and it will help me accumulate experience so why in the preparation step I mentioned I will learn through the project, Github Link: https://github.com/letuankiet212/basecode-reactjs-ts
  • HTML/CSS: We use the online interface for fast ( https://codepen.io/hanhttm/pen/WjBdbz ), HTML we will put in App.tsx file and CSS we will put in App.css file image.png

As the picture we can see the function of this app will include

  • New task creation function (*1)
  • Display task list (*2)
  • Function to display tasks by status all, active, completed (*3)
  • Clear function (*4)
  • Display the number of tasks (*5)

First we will go through the happy cases of the project to find out what to prepare:

  1. Load page -> Show list of available tasks=> get[List task]
  2. After entering text to create a new task -> Save the new task to the task list=> [input] -> [List task]
  3. Pressing the function buttons will display lists by status=> [Button<status>] -> <status> + [List task] -> [new List<status>]
  4. Clicking the clear button will delete completed tasks=> [Button Delete <status need remove>] -> <status need remove> + [List task]

    -> [Show new list task <no have status>]

So we will include 3 main components 1 input1 list show task displayed on the screen1 full main task list

Before starting to code I want you to always keep in mind that we will code for a big project so we will try to clear the code as much as possible, everyone.

We create a folder untils to contain types/constants/function--common

utils/types/Task.d.ts Contains type declarations of Task

utils/contants/index.tsx

utils/common.tsx (this place should be missing function–common)

The functions here will be reusable not only in this project but also in other projects

Let’s go to the main code

App.tsx

We will split the code into small parts to add functionality to each part image.png image.png

The rest of the code will look like this

TodoForm.tsx

Here we will handle the submit button function when entering new job name

Code :

TodoList.tsx

TodoOptionShow.tsx

Just enjoy the results In the first miniapp, I just learned to familiarize myself with Reactjs as well as useState + useEffect (I just discovered these 2 accounts and lost time) there are still some places that I haven’t forgotten so I have the code It’s quite young if you have any suggestions, please help me, I will upload the code to github, enjoy it through the video, I will create 2 branches to upload to the template, one that implements UI for TodoList and the other that contains common code I drew from this miniapp so I can just come here to see it later

image.png

The first post of my React learning series is here, if you think it’s good, please give me an upvote :p, it gives me the motivation to write a post to share a lot of experiences, see you in the next post. write next week

Share the news now

Source : Viblo