ToDo application with ReactJS and FeathersJS

Tram Ho

This article shares how I create a simple ToDo application with FeathersJS on the server side and ReactJs on the Client. I will go into some main parts of how to install, and use the FeathersJS client with ReactJS, so the article will skip quite a lot of parts such as data validation, effects, …

Setting

Create folders for the project:

Create service Tasks:

Edit src/models/tasks.model.js :

github

That’s it then server ?

Next to the Client, in the todo folder:

Install Feathers:

github

Done installing to be able to use Feathers on the client, now I can embark on React code ✌️

Sample interface

Write a Code

Install some additional libraries:

  • react-router-dom
  • material-ui
  • moment

Login and register

Registration:

github

The code below to handle the login:

github

Log in when you have accessToken in localStorage:

github

Put together a diagram for everyone to see:

Tasks

Get the whole task:

This code [task, user._id] means that when the task changes, I will reload the entire task list, I use this method to get back the task list when adding, and edit the status of the task.

Add new task:

Change state:

github

Result

Repo github: https://github.com/hungkieu/Feathers-React-Todo-App

I summarized the article with the main ideas as follows:

  1. Use the Feathers Client with ReactJS.
  2. Authenticate user.
  3. Add, edit, delete.

Thanks for reading my article ?

Share the news now

Source : Viblo