<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arosh Segar on Medium]]></title>
        <description><![CDATA[Stories by Arosh Segar on Medium]]></description>
        <link>https://medium.com/@arosh-segar?source=rss-45620b5f6e69------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8Xo3wxq8gAeA4DEe.jpg</url>
            <title>Stories by Arosh Segar on Medium</title>
            <link>https://medium.com/@arosh-segar?source=rss-45620b5f6e69------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:43:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arosh-segar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Internship experience as a software engineering intern at Rootcode]]></title>
            <link>https://medium.com/rootcodelabs/internship-experience-as-a-software-engineering-intern-at-rootcode-4f5906bedf5?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f5906bedf5</guid>
            <category><![CDATA[internship-experience]]></category>
            <category><![CDATA[tech-startups]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Wed, 23 Mar 2022 06:09:08 GMT</pubDate>
            <atom:updated>2022-04-08T08:54:29.974Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Sharing my exciting journey as a software engineering intern at Rootcode.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBd0CrGbHLdHa-RZvv1eqg.png" /></figure><p>It all began in the month of June. After a CV screen procedure, Rootcode picked me for an interview, and I was elated! Let me walk you through all the details!</p><p><strong>The interview process at Rootcode Labs</strong></p><p>The whole interview process was divided into three phases. During the first phase of the interview, I was asked some general questions as well as some tech-specific questions. Overall I thought that the interview was very well structured. A few days after, the people and the culture team said that I had passed the first phase of the interview and I’m qualified for the next phase. The next phase of the interview was a practical evaluation where I had to develop a small e-commerce application within the allocated time frame. I was asked to demonstrate what I’ve built, to some of the technical leads and they said that they were rather not looking for the completion of the project but rather the approach that I had taken. After a few days I got a call from the People and Culture team, and they said that I have been selected for the third phase of the interview.</p><p>The third interview was more of a quick chat with with Alagan and Mangala (CEO and the COO of Rootcode), which I found very insightful. Plus, it was a pleasure to see that even the C-level executives get involved with regards to recruiting an intern! Finally, they broke the good news to me saying “welcome to Rootcode”. I was really happy that I got selected for this internship and I’m also grateful that I got the opportunity to start my career at Rootcode with zero experience.</p><p><strong>How I kick-started my internship</strong></p><p>The first few days, I spent my time learning about Rootcode, getting to know my fellow colleagues, and adapting to the way of working at Rootcode. My initial task was to get hands-on experience on a mini-project, which led me to gain an idea of the tech, frameworks the company is using. As a person with no prior hands-on experience, this was a great launching point. Frankly speaking, it was challenging, but I was able to learn so much within a limited time frame thanks to my team leads and mentors. Thanks to the support system and the friendly culture at Rootcode, I was able to reach out to anyone at any time if I came across a difficulty. This contributed to my learning process at Rootcode as an intern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K57NtdXHPgVGUOHq" /></figure><p>The training and development process that I underwent helped me become a better engineer every single day. I was asked to complete the allocated tasks within a given time constraint and then a Senior developer would review the work that I have done and give feedback. I believe this was very effective since I was able to learn simultaneously while I’m working on a project.</p><p>Whenever I have to learn something new, I would seek guidance from Senior developers and Tech leads working on the same project and then refer to the official documentation and other articles, for better understanding. This not only improved my reading habit but also improved my communication skills!</p><p><strong>Learning and development</strong></p><p>I’m so glad for the fact that I got to learn a lot of new things at Rootcode. Even though I had an idea about the project management processes followed at Rootcode, I have never used any project management tools for the projects that I worked on before. The whole project management process was new to me, and with time, I got an in-depth idea about the whole process.</p><p>At the very beginning of my internship, I wasn’t familiar with many of the tools that were used by the team. The only library I was familiar with was React and during the first week, I was asked to learn tailwind CSS for styling and Next.js for server-side rendering. I also worked on animating certain components using React Spring and Keyframes. This was a great experience!</p><p>Whenever I do a university project, the main focus would be led towards the functionalities of the app that I’m developing but here I had to focus on other aspects of the application as well, such as performance, responsiveness, usability, code quality, etc. Since I was involved in different phases of the software development life cycle (SDLC), I understood the different stages that the product goes through and the outcome of each stage through practical encounters.</p><p>Over a few months, I not only learned new frameworks, technology, etc. but also learned the work that other teams perform (QA, UI, Marketing, etc.) and how their work influences the overall success of a project. <br>As a university student who had to juggle studies and work, I also learned how to be better at time management and stay organized.</p><p><strong>Project experience</strong></p><p>After the first week of training, I was assigned to a project called the <a href="https://expertrepublic.com/"><strong>Expert Republic</strong></a><strong>.</strong> Speaking a little bit about Expert Republic, it is a mobile and web application that provides secure, trusted one-to-one, and video consultations between industry experts and customers. The application provides a platform for businesses/individual professionals to make their services available online so that customers can obtain the service from their homes or from wherever they are. One month later I was assigned to a project of revamping the Rootcode website, which was also an interesting one. You can check out the brand new look of the Rootcode website right <a href="https://rootcodelabs.com/"><strong>here</strong></a><strong>.</strong></p><p><strong>Rounding up</strong></p><p>Simply putting in, every day I’m given a task to complete, and that task might carry a lot of problems. I like how I end up exploring and learning new things in the process of finding a solution. The learning and development curve that I underwent is enormous concurrently exciting as well. Thanks to the well-structured processes and the guidance received from the seniors, I’ve gathered so much knowledge and experience during the past few months working at Rootcode.</p><p>One of the best things that I like about Rootcode is the freedom that you have to talk to anyone, even with the CEO or COO at any time with no restrictions. All team members are always willing to help and sometimes they even leave aside their work and try to help me find a solution to the problem. It really did feel like I’m working with a bunch of great friends. Genuinely, this is a work community that feels like family!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f5906bedf5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootcodelabs/internship-experience-as-a-software-engineering-intern-at-rootcode-4f5906bedf5">Internship experience as a software engineering intern at Rootcode</a> was originally published in <a href="https://medium.com/rootcodelabs">Rootcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to connect your node application with Cloudinary to upload files]]></title>
            <link>https://arosh-segar.medium.com/how-to-connect-your-node-application-with-cloudinary-to-upload-files-c36fa48e7bde?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/c36fa48e7bde</guid>
            <category><![CDATA[file-upload]]></category>
            <category><![CDATA[storage]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[cloudinary]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Sun, 30 May 2021 18:03:46 GMT</pubDate>
            <atom:updated>2021-05-30T18:03:46.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Yz6wxyqX09fU2x6S2jCDw.jpeg" /></figure><p>When developing node applications one of the common problems you may encounter is when uploading files. There are many ways to upload files in your node application. Multer can be used to upload files in your application and the uploaded files will be stored in the local storage. However if you want to deploy your program online then storing the files locally would not be a wise decision because the location you save it might not the same when the application is deployed in the cloud. Therefore a cloud based file storage solution is required. There are many solutions for node applications such as google cloud storage, grid gf etc. However in this blog we’re going to look at a Saas solution called Cloudinary which very easy to use and connect to your application. This platform allows users to store, manage files for their web applications. This was mainly designed to store photos and videos but other types of files are also supported.</p><p>We will only be looking at how to connect the node application with Cloudinary and how to upload an image to Cloudinary through the application. Server configurations will not be explained however the picture of the configurations will be provided.</p><p>Packages you will need :</p><p><em>express , dotenv , multer , cloudinary</em></p><p><strong>Server configuration to run the server on port number 5000</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*l4zrQ2AXgpubyU8sBYb4sg.png" /><figcaption>server.js</figcaption></figure><blockquote>Next you need to create a cloudinary account and the name, api key and api secret will be given in your Cloudinary dashboard which are the information required to connect your Cloudinary account with your application.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*G1DITJ4rN-YIWOFXCCQlPA.png" /><figcaption>Cloudinary dashboard</figcaption></figure><blockquote>Next you need to create a .env file and add the details as mentioned in the picture. (I have given * as my api secret you need to add your secret api provided by cloudinary)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*bZGHzZIGCMQOkTtaw-969w.png" /><figcaption>.env</figcaption></figure><blockquote>Next create a folder called utils</blockquote><blockquote>Create a file call multer.js</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*pYitO4kJ5NB6uEelF9UwvQ.png" /><figcaption>multer.js</figcaption></figure><blockquote>The above function determines the type of file that can be accepted. According to the implementation it is designed to accept only images with extensions .jpg, .jpeg or .png.</blockquote><blockquote>Next create a file called cloudinary.js in the same folder</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*2z9yyq0vA4A0JL63iRQ3-w.png" /><figcaption>cloudinary.js</figcaption></figure><blockquote>This file connects the cloudinary storage to your application using the details you provided in the .env file.</blockquote><blockquote>Next create a folder called routes and create a js file inside that folder to write your routes.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*XUckPxZyZ0cskJMdJ-uq6A.png" /><figcaption>user.js</figcaption></figure><blockquote>You need to import cloudinary and multer from the utils folder and also the express router. If the file is successfully uploaded it will execute the rest of the statements but if there’s a problem in uploading it wil create an exception.</blockquote><blockquote>According to the code I am printing the result object which will contain the result of the upload if the upload was successful.</blockquote><blockquote>I uploaded an image and the following was printed in the console.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*qsCJZYF7WHuu3lZJCqw1Ow.png" /></figure><blockquote>These are the details of the file which was uploaded to your cloudinary account. The string stored in secure_url contains the url to the file uploaded in cloudinary which could be accessed easily.</blockquote><p><strong>Hope you found this article useful !!!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c36fa48e7bde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to upload images using Multer in the MERN stack]]></title>
            <link>https://arosh-segar.medium.com/how-to-upload-images-using-multer-in-the-mern-stack-1c6bf691947e?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c6bf691947e</guid>
            <category><![CDATA[multer]]></category>
            <category><![CDATA[image-upload]]></category>
            <category><![CDATA[mern]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Fri, 14 May 2021 16:12:31 GMT</pubDate>
            <atom:updated>2021-05-14T16:23:42.515Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TWc0f86DCLFMUkN6u9ogw.png" /></figure><p>Many of you might’ve come across a situation where you had to upload an image or any type of file to the server. Some of you might’ve succeeded while some of you might’ve failed. This blog will demonstrate how a library called Multer helps to store the files selected from the client side to a local storage and store the file name to the database so that file name could be used to locate the file in the local storage.</p><p><strong>Multer</strong></p><p>Multer is a node js middleware which helps to upload files. You have to make sure that your form is processed via multipart form data because Multer only accepts and processes multipart form data at the backend. (This will be explained with an example)</p><p><strong>Lets get started !!! </strong>⌨️</p><blockquote>Folder structure</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*x5xIL7atTdE4HHQgiQQYrA.png" /></figure><p>The client side implementations are done in the front-end folder and server side implementations are done in the back-end folder.</p><blockquote>Front end</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*R8EHIWfIqoCFyEeIIWCpwA.png" /><figcaption>Front end folder structure</figcaption></figure><p>First create a react app inside the front-end folder if you haven’t created one already.</p><p><strong><em>npm create-react-app .</em></strong></p><p><em>Dependencies you’ll need :</em> <em>axios</em></p><p>I have used React Hooks but class component also works fine</p><ol><li><strong><em>Import statements</em></strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*5azfzyI2fpE9iG9hOpe1oQ.png" /></figure><p><strong>2. <em>Declaring a variable using hooks</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*bSRloRr2TKD4zDJyHUSQgg.png" /></figure><p><strong>3. <em>Rendering the form</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*RgVGvq3fj9HHnkHOEScICA.png" /></figure><p>Note : make sure to embed the encType attribute in the form tag because multer only processes multipart form data</p><p><strong>4. <em>Methods to handle the inputs</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*uHG0HsCSo2forhd1qbX0TA.png" /></figure><p><strong>5. <em>On submit method</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*MgGVIUVnz1sbgo8gSsmx4g.png" /></figure><p>Axios is used to make http requests. Make sure to use form data to assign inputs and pass it to the axios method.</p><blockquote>Back end</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*9iXKKBbIdrPtctnt6TIFMA.png" /><figcaption>Back end folder structure</figcaption></figure><p><em>Dependencies you’ll need : express, cors, mongoose, multer</em></p><ol><li><strong><em>First you need to configure the server.js file to connect to the database and also connect the routes. (I have used Mongo DB Atlas as the database and provided the connection link in a separate file and assigned it to ATLAS_URI)</em></strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*GrFpJ1QtZsMmD61dhgzgmg.png" /><figcaption>server.js</figcaption></figure><p>2. <strong><em>Then you need to define the schema to describe the structure of the data to be stored in the database</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*vQ1khwP6AIMmKvKg6zy9xA.png" /><figcaption>user.modal.js</figcaption></figure><p>3. <strong><em>Next you need to define the route to receive the form data and store it in the database. (user.js)</em></strong></p><p><em>import statements</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*IcPmc2VglOHXd_j-6YsnxA.png" /></figure><p>defining the local storage location so that the files received from the client will be saved in the defined location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*qm0MrUmW_cdLOssb8aCnVA.png" /></figure><p>I have used uuid to generate a unique name for the images uploaded because when the same file is uploaded more than once it will not duplicate the filename.</p><p><em>defining the post route method</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*bkFumPX8LkByIr6Z2ZoyKA.png" /></figure><p>upload.single(‘photo’) accepts the photo and stores it in request.file object. The filename will be stored in the database and not the whole file. The file will be saved in the local storage in the folder called ‘images’. The file could be accessed by the filename stored in the database.</p><p>Hope this works for you !!! 😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c6bf691947e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Establishing a connection with MongoDB and React using Koa js]]></title>
            <link>https://arosh-segar.medium.com/establishing-a-connection-with-mongodb-and-react-using-koa-js-f98a92b42ab3?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/f98a92b42ab3</guid>
            <category><![CDATA[koa]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Sun, 02 May 2021 17:05:03 GMT</pubDate>
            <atom:updated>2021-05-02T17:07:38.403Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Establishing a connection with MongoDB and React using Koa js</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*S7Bfb--NE90H3D3W3COk3g.png" /></figure><p>In this blog we will be looking at connecting the Mongo DB with React so that data manipulations could be done in the front-end with data stored in the local server.</p><p><strong><em>dependencies you will need for the front-end:</em></strong></p><p><em>axios will be used for http requests in this example</em></p><p><strong><em>dependencies you will need for the back-end:</em></strong></p><p>koa,@koa/cors, mongodb, koa-bodyparser</p><p><strong>Let’s start with the backend</strong></p><blockquote>First you need to set up your back-end server with Koa</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*M9__EqP82h6y2xIKoS-LGQ.png" /></figure><blockquote>Then you need to run your mongo db server locally and establish a connection with your application</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*NFFh67bHr-Cf_RRhG-nqNA.png" /></figure><blockquote>The next step is to define the http routes that need to call the apis to perform the appropriate db operations. The example below only shows two methods.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*KDsopf-dqOJKbxCJpAe55g.png" /></figure><blockquote>Next, you need to write the apis that will perform the db operations</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*2d1gKvTqYO2VLamRm4S9Dw.png" /></figure><blockquote>The final step in the back-end is to write the methods to perform the db operations. However only adding and retrieving data is explained.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*dApamnA64WJ1l771JIiSkA.png" /></figure><p><strong>Now let’s take a look at how data is fetched to the front-end</strong></p><p><em>We’ll be using axios to perform the http requests</em></p><p><strong>Get all the data from the database</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*oKx6WBr-KqTNFNOMYuHBcQ.png" /></figure><blockquote>As you can see, only the route is used and the api calls and db calls are hidden which makes it more cleaner and simpler. This retrieves all the collections from the database and assigns to a state variable. This state variable can then be used in the front-end.</blockquote><p><strong>Add a record to the database</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*nlmCjHt7EnWltXFZyjWa6A.png" /></figure><blockquote>The object created will be sent as a parameter in the post method which will then be handled by the back-end and if there are no errors it will be successfully added to the database.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f98a92b42ab3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fundamentals of State Hook in React Hooks]]></title>
            <link>https://medium.com/geekculture/fundamentals-of-state-hook-in-react-hooks-6e10f46fd2fc?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e10f46fd2fc</guid>
            <category><![CDATA[react-hook-usestate]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Fri, 16 Apr 2021 13:20:51 GMT</pubDate>
            <atom:updated>2021-04-22T09:11:58.642Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdkEvoNMusSGEuuqUZ0OLg.jpeg" /></figure><p><strong><em>What is React Hooks?</em></strong></p><p>This feature is available in the latest version of React which enables programmers to write the usual react programs and handle the state without converting them into class components. React programmers would know that state cannot be created without the help of classes and with React Hooks that could be made possible by using <em>useStateHook </em>within a functional based component. Hooks cannot be used within classes since it allows you to use it without the help of classes which will not allow to use the lifecycle methods such as <em>componentDidMount</em>, <em>componentDidUpdate</em>, <em>componentWillUnmount</em> etc. instead Hooks use some in built methods.</p><p><strong><em>Rules of React Hooks</em></strong></p><ol><li>Make sure not to call Hooks inside loops, conditions, or nested functions. It can be called only<em> </em>at the top level.</li><li>Make sure to call Hooks from within React components and not within regular JavaScript functions</li></ol><p><strong>Getting things ready</strong></p><p><strong><em>You need to make sure that you have React version 16.7 or above installed if you want to work with Hooks</em></strong></p><p>First of all you need to create a react app. (I am creating a react project in the folder I’m currently in)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*hUCOvGKGxA1avCdn4PGmug.png" /></figure><p>If you have an older version then you need to install version 16.7 or above</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*fcTDZcxXr2iBsPcAp0sO-Q.png" /></figure><p>Now lets take a look at one of the most important hooks</p><p><strong>State Hook</strong></p><p>This Hook allows us to work with states within a function.</p><p><em>The first step of working with Hooks in a function component would be to import the useState module.</em></p><blockquote>import React, { useState } from &#39;react&#39;;</blockquote><p><strong><em>Declaring a state variable</em></strong></p><p><em>Declaring a state variable in a class component</em></p><blockquote>class Example extends React.Component {<br> constructor(props) {<br> super(props);<br> this.state = { count: 0 }; <br>}</blockquote><p><em>Declaring a state variable in a function component</em></p><blockquote>function Example() {<br>const [count, setCount] = useState(0); <br>}</blockquote><p><em>In the above examples the class component uses state to create a count variable whereas the second example uses Hooks to create a count variable inside a function. The useState method returns two pair of values which could be accessed as two elements of an array. The 0th element is the current value and the 1st element is a method that allows you to update the current value. In the example above destructing is used to assign the current value to the variable count and the updating method to the setCount variable.</em></p><p><strong>Accessing the states</strong></p><p><em>Displaying the count variable in a class component</em></p><blockquote>&lt;p&gt;You clicked {this.state.count} times&lt;/p&gt;</blockquote><p><em>Displaying the count variable in a function component</em></p><blockquote>&lt;p&gt;You clicked {count} times&lt;/p&gt;</blockquote><p>The first example shows how the count variable is accessed within a class component and the second example shows how the count variable is accessed which uses Hooks.</p><p><strong>Updating the values in a state</strong></p><p><em>Updating a state varibale in a class component. The setState method is used to update the class level state variables.</em></p><blockquote>&lt;button onClick={() =&gt; this.setState({count: this.state.count+1})}&gt; Click me<br>&lt;/button&gt;</blockquote><p><em>Updating a state varibale in a function component. The setCount method is used to update the Hook state variable. This is the method which is returned by the useState method which allows to update the current value of the count.</em></p><blockquote>&lt;button onClick={() =&gt; setCount(count + 1)}&gt; <br>Click me<br>&lt;/button&gt;</blockquote><p><strong>Reference</strong></p><p><a href="https://reactjs.org/docs/hooks-intro.html">https://reactjs.org/docs/hooks-intro.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e10f46fd2fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/fundamentals-of-state-hook-in-react-hooks-6e10f46fd2fc">Fundamentals of State Hook in React Hooks</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some essential ES6 features you need to know before learning React]]></title>
            <link>https://arosh-segar.medium.com/some-essential-es6-features-you-need-to-know-before-learning-react-a84e038ffbc1?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/a84e038ffbc1</guid>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 19:15:59 GMT</pubDate>
            <atom:updated>2021-04-02T19:19:45.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XfyXryUMlv7ZTdIoxXoCjA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qzSi1lZx-4Y733QbDw-h1w.png" /></figure><p><strong>1. let/const variables</strong></p><p><em>Declaring a variable using the ‘let’ keyword allows that variable to be used only within the block in which it is defined (block scope). The variable that is declared using the traditional ‘var’ keyword can be accessed within the function.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*Z9V8i1tzUztOjvdjVKYMEg.png" /><figcaption>let used in a for loop</figcaption></figure><p><em>The output of the above code would be 0 1 2 3 4 and the line no 9 will cause an error since the variable ‘i’ could be used only inside the for loop. Declaring a variable as ‘const’ would be the same as ‘let’ except it is fixed and cannot be re-assigned later in the code. The decision to select which keyword to use depends on whether you will re-assign values to a variable or not.</em></p><p><strong>2. Objects</strong></p><p><em>Objects in JavaScript are basically defined as key-value pairs. The attributes or functions could be accessed by using the dot operator as shown in the image. ES6 introduced the new way of defining method inside an object and it is also show in the image.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*UCQQXdvcra6gXdhiLsXY0w.png" /><figcaption>person object</figcaption></figure><p><strong>3. ‘this’ keyword</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*7-9tPzo_g1SzL28KSykMMA.png" /></figure><p><em>The ‘this’ keyword refers to the object/context it is situated in. If it is placed inside a function then the ‘this’ keyword would refer to the object that resides inside the function. Bind method is used to explicitly define which context should used when calling a method. If the bind method was not used in this example then it would’ve referred to the window object which is the outer most object.</em></p><p><strong>4. Arrow function</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*55Szse3YtB9ccYSnTr_LAQ.png" /></figure><p><em>The first method definition might be very familiar and the second is also a method but it is defined in a completely different way and this way of defining methods is called arrow functions. Both of these methods perform the same task. The ‘this’ keyword inside an arrow function will refer to the object that it belongs to despite from where that method is called and bind method wouldn’t have to be used unlike before.</em></p><p><strong>5. Object destructuring</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*mMXHXKVCjWoAxbzwrHDNPQ.png" /></figure><p><em>Object destructuring helps to simplify the way object data are manupulated. Rathen than declaring variables and assigning variables to each variable (line 7–9) it could be simply declared in a single statement as done in line 11. The name specified inside the curly braces should be the same name as the attribute in the object.</em></p><p><strong>6. Spread operator</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*MovTuIM1dG1e5YU3_VYBvQ.png" /></figure><p><em>The concat method can be used to combine two arrays together. However if there are more arrays to combine or elements to add then this becomes a bit complicated but thanks to ES6 the spread operator could simply combine as many arrays or even elements as desired. As the name implies the spread operator spreads out all the elements in contains.</em></p><p><strong>7. Classes</strong></p><p><em>We all know how object literals work and new objects cannot be created using the same structure of that object without the help of a class. However to work with classes in older versions of JavaScript large implementations need to be written but later versions have simplified this as well.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*z-o_h3JINzHTmrljCNkt9g.png" /><figcaption>class definition</figcaption></figure><p><strong>8. Modules</strong></p><p><em>These help to organize as well as maintain your application well. This helps to break each method, class or component into a separate module and use it across other modules or files. Also modules are private by default and in order for other modules to use it, it should be exported.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*WSJuJbxIvW1NLeDPA7vwiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*EuSaB4nYaje3xOFPkCKZKA.png" /><figcaption>exporting Person class and importing and extending it in Teacher class</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a84e038ffbc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with MongoDB Atlas and Mongoose…]]></title>
            <link>https://arosh-segar.medium.com/getting-started-with-mongodb-atlas-and-mongoose-20715b3619be?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/20715b3619be</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongoose]]></category>
            <category><![CDATA[mongodb-atlas]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Fri, 19 Mar 2021 09:28:18 GMT</pubDate>
            <atom:updated>2021-03-19T09:30:51.544Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>MongoDB Atlas</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*QXDEreHDglXtm_DJBgd7KQ.png" /></figure><p>As many of you might know that MongoDB is a highly popular non-structured database used by many growing organizations such as Google, Adobe , eBay etc. MongoDB Atlas could be used to store your applications data in the cloud. Even though it is highly scalable and easy to manage, one of the main downsides of it is that, only 512mb of storage would be available to use for free and any extension of storage should be purchased.</p><p><strong>Mongoose</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*NXRZWQAlcDh-nmAExZpFKw.png" /></figure><p>Mongoose is used to structure the data that is stored in the database. Through Mongoose you can set constraints to the data, perform crud operations and also write queries which is a little similar to the way SQL databases work. This defines how data should be arranged and this structure is also known as the DB schema.</p><p><strong>Configuration of MongoDB Atlas and Mongoose</strong></p><p>Express backend framework will be used to demonstrate how both MongoDB Atlas and Mongoose are interconnected and also basic functionalities and installation will be explained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*P9-W_ERqL1p5L_zRLKf0dQ.png" /></figure><p>This is how the folder structure of the backend would look like after all the configuration.</p><p><em>FoodModel.js :</em> This is where the schema is defined <br><em>FoodRoutes.js :</em> This is where the CRUD operations are defined<br><em>server.js :</em> This is the file that uses express to connect to the cloud database</p><p><strong><em>Step 1 : Installing Express module to your project</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*msb6suzBI7zbR4YbiIEAzA.png" /></figure><p><strong><em>Step 2 : Setting up MongoDB Atlas</em></strong></p><p>First you need to create an account and create a cluster to work on. You can create a free cluster of 512mb of storage for free and if you require more storage you will have to make payments accordingly. You can select the desired cloud provider and finally create your cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*RFos8iAcjnwIaYlENrqcYA.png" /></figure><p>Once you create your cluster you will be able to see it your dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*5Z1oHF-Lm9YuMiCZ2CCLuw.png" /></figure><p>Click connect to connect your cluster with your application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*ddSkHLrr11vcjseofZZ0Bw.png" /></figure><p>Then you need to click connect your application and add the user details and also add your ip address and you will be able to see the url to connect your application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*zMTbskvSpEq4X9eWJeGU3w.png" /></figure><p><strong><em>Step 3 : Connecting MongoDB Atlas cluster with your application</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*Sgser6Esb_MOyu-q0yIHow.png" /></figure><p>This file should import express, mongoose and also the routes files. The mongoose.connect() function takes in two parameters in the example. The first is the string you copied from the cluster and the second is the useNewUrlParse which is basically used to prevent an error from showing up. You need to make sure to replace the &lt;password&gt; with the password provided in the MongoDB atlas. Then this will set a server on port number 3000.</p><p><strong><em>Step 4 : Define the Schema</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*5YX_ngvLZrAa1F0MnIdqAA.png" /></figure><p>Like mentioned before the data is structured in this file. The constraints to certain attributes are defined here such as data type , whether it should contain a value or not etc. These constraints are called options. This also needs to import the mongoose module. The modules should be imported wherever it is used.</p><p><strong><em>Step 5 : Defining CRUD operations in routes</em></strong></p><p>There are many operations in Mongoose but we’re only going to look at 4 main functions. They are find(), save(), findByIdAndDelete() and findByIdAndUpdate().</p><p><em>i . Reading data from the collection | find()</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*tZaNPvPDJNQKzp1_KFPcfw.png" /></figure><p>This method returns the whole collection of the food model and send it as response.</p><p><em>ii. Creating a new instance in the collection | save()</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*qMy7Hbc0f6CIuRpjciLenw.png" /></figure><p>This creates a new instance in the collection based on the inputs from the request object and sends the food object as a response</p><p><em>iii. Deleting a specific instance from the collection | findByIdAndDelete()</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*-sgo3gtKmnnV6CK6eVQXxw.png" /></figure><p>Each instance is identified by some attributes uniquely and by passing this id through the response object it could delete that particular instance by getting that ID through the request object.</p><p><em>iv. Updating a specific instance from the collection | findByIdAndUpdate()</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*lqJEBwXmZhHB7RfCRyMCpQ.png" /></figure><p>This receives the id the same way as the delete function and updates the data of that specific instance which are received through the request object. The save() method is used afterwards to save the update on that instance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20715b3619be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important things to know before learning the MERN stack]]></title>
            <link>https://arosh-segar.medium.com/important-things-to-know-before-learning-the-mern-stack-f921a6dc3f54?source=rss-45620b5f6e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/f921a6dc3f54</guid>
            <category><![CDATA[mongo]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[mern]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Arosh Segar]]></dc:creator>
            <pubDate>Wed, 03 Mar 2021 13:36:22 GMT</pubDate>
            <atom:updated>2021-03-07T13:18:33.996Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVtCyRdJ6KOr4YswTtwMeA.jpeg" /></figure><p>In earlier days, JavaScript was used only in Front-end development and later on, modern frameworks were developed using JavaScript due to it’s scalable and powerful features. New frameworks are being developed using JavaScript as the foundation. With all the modern enhancements of this scripting language it is now possible to also work on backend development using JavaScript frameworks.</p><p>MERN stack is a complete JavaScript based technology which is more than enough to build a web application from front end to back end. Many developers are using this stack these days. There are other stacks out there such as MEAN, MEVN etc. However, all these stacks are somewhat similar where only the front end tools are changed (Angular , Vue etc.). The following are some ways that might be helpful before starting to learn the MERN stack.</p><p><strong>1. Try to learn each component individually</strong></p><p>This is a common mistake most people make when learning this powerful technology. You shouldn’t start learning this stack as whole at once if you’re an amateur, because you might not know where to begin and how to solve any issues you may encounter. Even though, the MERN stack is a simple technology to learn if not learned in a proper manner it could take a longer period to understand the concept behind it. Learning each component (Mongo DB , Express , Node , React) individually before learning it as whole could help you understand it more easily and also you would understand how everything is connected to one another.</p><p><strong>2. Learn the fundamentals of JavaScript and ES6</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kc1ZLVd-ufD7dcxyUoMgw.jpeg" /></figure><p>Understanding the fundamentals of ES6 would be very helpful to understand the syntaxes of React since most of its features are developed using ES6. ES6 stands for ECMAScript 6 which was invented to standardize JavaScript and is the 6th version of ECMAScript.</p><p><strong>3. Version Controlling Tools</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*WaaXnUvhvrswhBJSw4YTuQ.png" /></figure><p>Experience on version controlling tools is an added benefit when it comes to developing a project as a team. This makes it much simpler to manage the projects that you and your team are working on.</p><p><strong>4. It is always better to follow some principles and standards</strong></p><p>There are many Software Engineering coding standards and practices. It is not mandatary to follow these principles or practices but doing so would make your project more readable, neat and also increase the performance and quality of the project. One of the popular principles is the <em>S.O.L.I.D</em> principle. This is built upon Object Oriented concepts. This principle consists of</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*_kIro5M3Lo2KF81WOX3IMA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f921a6dc3f54" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>