After searching for a while I came across a application called NodeChat. In Issue #11 for the NodeChat project the owner asked for someone to move the public site over to React. Having used React, Node.js and Socket.IO I asked in the issue if I could do this. After, that I started my work on the React app to replace the JQuery version that was previously used in the project.
Making a chat app using React
I started off with some project designing. I needed to figure out how I wanted to organize the react app. Also, I had to go through the existing JQuery file to get a better understanding of what the project is doing.
I decided on the below structure for the app.
- This component is the core of the app were the Login Page is called and is currently were all the css and assets are located.
- This component handles new and previous user login’s. And handles displaying the login page or the chat page.
- This compenent handles all the functionality of the chat.
Currently the flow of the app is as follows the app page displays the Login page. The login page creates a new user or uses a previous user then the Login page decides when to display the Chat page.
A update I think I will do at some point would be to make it so the App page receives props back form the Login page. That would instruct the App page when to display the Chat page. I think this would be a bit cleaner code.
There is still a bunch of stuff that need’s to be finished but at the moment the app is working on a basic level. I am hoping to get most of the bugs fixed as soon as I can.
I think this will be a good project for me over Hacktoberfest and probably after.
Here’s the link to my first PR of Hacktoberfest .
Below is the 2 class definitions for Login Page and Chat Page and I added a small comment about each function. Full Code available here.