<?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 Sarthak Jha on Medium]]></title>
        <description><![CDATA[Stories by Sarthak Jha on Medium]]></description>
        <link>https://medium.com/@hello_78585?source=rss-c5c7ad067ae5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*x5YaQ6gGkIM5BmaZPPbRnQ.jpeg</url>
            <title>Stories by Sarthak Jha on Medium</title>
            <link>https://medium.com/@hello_78585?source=rss-c5c7ad067ae5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:38:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hello_78585/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[Understanding React Lifecycle Methods]]></title>
            <link>https://blog.commutatus.com/understanding-react-lifecycle-methods-de0e33bf3319?source=rss-c5c7ad067ae5------2</link>
            <guid isPermaLink="false">https://medium.com/p/de0e33bf3319</guid>
            <category><![CDATA[react-lifecycle-method]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-lifecycle]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react-tutorial]]></category>
            <dc:creator><![CDATA[Sarthak Jha]]></dc:creator>
            <pubDate>Mon, 09 Sep 2019 09:25:23 GMT</pubDate>
            <atom:updated>2019-09-09T09:25:23.971Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*U189x--O7Ca3nAbgv37a9g.jpeg" /><figcaption>Understanding React Lifecycle Methods</figcaption></figure><p>As a React Noob, a few things always made me feel like a deer in the headlights. Redux, GraphQL, React Native and React lifecycles being a few of them. For being at a loss of words to explain my fears, here’s a pictorial representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/0*lDpcdvR2OA-stVGS" /><figcaption>dogerman!</figcaption></figure><p>This is what they turned out to be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*vGWuQtW5T6niPe24jPmDrA.gif" /><figcaption>A fluffy bundle of joy</figcaption></figure><p>So, here’s a short article about React Lifecycles to help other beginners like me.</p><h3>What exactly are these Lifecycle methods?</h3><p>A component in React can be in one of the following life phases at any point of time:</p><ol><li>Mount</li><li>Update</li><li>Render</li><li>Unmount</li></ol><p>So, Lifecycle methods are a piece of code that is triggered when one of these phases starts or ends. They deal with the lifecycle of the component, which is the period through the component is alive. They can also be used to define the functionality of a component and how they React(pun intended) to different stimuli.</p><p>They seemed like a fancy set of features that I thought I didn’t need. But boy was I wrong! Their presence can make a huge difference in your app. More on that later.</p><p>Following are the available lifecycle methods at the time of writing this article:</p><ol><li>constructor</li><li>getDerivedStateFromProps</li><li>render</li><li>componentDidMount</li><li>shouldComponentUpdate</li><li>getSnapshotBeforeUpdate</li><li>componentDidUpdate</li><li>componentWillUnmount</li><li>getDerivedStateFromError</li><li>componentDidCatch</li></ol><h3>1. constructor( ):</h3><p>The constructor() is the first method to be called when a component mounts.</p><p>Do’s:</p><ul><li>Initialize state.</li><li>Get props from the parent component.</li><li>Bind classes. (If you’re still not using ES6 functions. Hopefully, you are.)</li><li>Create refs to elements of the component.</li></ul><p>Don’t:</p><ul><li>Make API requests.</li><li>Try to access elements or their properties, as they might have not been created in the DOM yet.</li></ul><h3>2. getDerivedPropsFromState( ):</h3><p>It is called while mounting and updating the component. (meaning that it is executed on the initial render and the subsequent renders too)</p><h3>Do’s:</h3><ul><li>Get the new props, and return a state based on those values.</li><li>Think hard before using it. Question your motives, your actions, and even your existence before you start using this method. Do you really need to use it?</li></ul><h3>Don’t:</h3><ul><li>Use this method excessively. React preaches a single source of truth, so if you’re getting your values from the props you shouldn’t have to store them in the state. Use them directly as setState is asynchronous and batched together, so there might be an instance when the component has received new props and yet the state hasn’t been updated. Thus it ends up using the older set of values.</li></ul><h3>3. render( ):</h3><p>It is the most commonly used method in all the react apps. It is responsible for displaying the component by returning JSX of the component.</p><h3>Do’s:</h3><ul><li>Code the visuals of the component.</li><li>Attach data to be displayed.</li></ul><h3>Don’t:</h3><ul><li>Perform heavy computations (use separate functions for those computations)</li><li>Make API requests</li><li>Put any action that needs to occur only once in the lifetime of the component here.</li><li>Set the state here. (Your app will be thrown into an infinite loop of rendering as this.setState will change the state and then call the render function which in turn will again set the state and so on.)</li></ul><h3>4. componentDidMount( ):</h3><p>Ahh! One of the interesting lifecycle methods that react gives us. It is called after the first render of the component.</p><h3>Do’s:</h3><ul><li>Since it’s called after the first render, the DOM will have all the components to play with.</li><li>Use it to attach event listeners.</li><li>Use refs to do various stuff like focus, scroll, etc.</li><li>Make API calls here</li><li>We can set the state here.</li></ul><h3>Don’t:</h3><ul><li>Use it for recurring tasks. It is called only once so don’t put the code here that needs to be executed several times.</li></ul><h3>5. shouldComponentUpdate( ):</h3><p>The Best Lifecycle Method Ever!</p><p>It returns either true or false, telling the component if it should re-render or not. It executes before every render after the first render is finished. It provides us with the “prevProps” and the “nextState”. We can use this.props and this.state to get the current values and make custom conditions for the component to re-render. It can bring down the render count from 100s or 1000s to a single render when needed which leads to a huge performance boost too.</p><h3>Do’s:</h3><ul><li>By default, a component will render again whenever it receives a new prop or state. So this sweet little bundle of joy helps reduce these re-renders which aren’t needed.</li><li>Use the props and state values to check if the value required by the component is actually changing or not. (It could very easily be a different prop value that’s being changed and our poor components have to re-render without any merit or need.)</li></ul><h3>Don’t:</h3><ul><li>Be reckless with it. Use caution while using this method. You can easily make a mistake if you don’t keep a track of the needed props, which will lead to an unresponsive application when data is changed.</li><li>Leave the return from the function empty. Make sure to return either true or false as per the conditions.</li></ul><h3>6. getSnapshotBeforeUpdate( ):</h3><p>It is called between an updated render and the result being displayed on the DOM. It is like a photograph of the sweet past memories. It should be used to initiate actions while the DOM updates.</p><h3>Do’s:</h3><ul><li>Pass the needed information from the last render to the updated one. (like scroll position)</li></ul><h3>Don’t:</h3><ul><li>Run heavy computations here, as they might not finish in time.</li></ul><h3>7. componentDidUpdate( ):</h3><p>This method is called after the component has been updated. The users can access the prevProps, prevState and the values returned from the getSnapshotBeforeUpdate() method here It can be used to initiate actions after the DOM has updated.</p><h3>Do’s:</h3><ul><li>Perform actions like scrolling to the new position or the old position, or calculate values depending on both the new and the old props or state.</li></ul><h3>Don’t:</h3><ul><li>Be reckless here. It will only trigger if the component updates. So actions initiated here should be designed while keeping the same in mind.</li></ul><h3>8. componentWillUnmount( ):</h3><p>It is called when the component is about to be unmounted. We mostly use it to clean up the actions initiated throughout the life of the component.</p><h3>Do’s:</h3><ul><li>Cancel ongoing API requests if any.</li><li>Remove event listeners added through componentDidMount() method</li></ul><h3>Don’t:</h3><ul><li>Set a state here. Or any other updates to the component either.</li></ul><h3>9. getDerivedStateFromError( ):</h3><p>We can use this method when something goes wrong. It’s kind of like the catch scope of try-catch.</p><h3>Do’s:</h3><ul><li>Use it to display an error screen with information about the same.</li><li>Handles errors from the children components as well.</li></ul><h3>Don’t:</h3><ul><li>Use it for anything other than displaying or logging errors</li></ul><h3>10. componentDidCatch( ):</h3><p>It is almost the same as getDerivedStateFromError() with the only difference being that it’s used to log the errors, and can only catch the error from other lifecycle methods. It doesn’t concern itself with the event errors.</p><h3>Do’s:</h3><ul><li>Use it to log errors.</li><li>Mostly developer usage.</li></ul><h3>Don’t:</h3><ul><li>Use getDerivedStateFromError() to handle event errors.</li></ul><h3>Summary:</h3><p>React lifecycles are a great way to control our app’s behaviour precisely. They can enhance the user experience by a huge margin if used correctly. You’ll be a react master in no time once you get familiar with the flow of control and data, and how to tweak it using react lifecycles. Feel free to drop your opinions in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de0e33bf3319" width="1" height="1" alt=""><hr><p><a href="https://blog.commutatus.com/understanding-react-lifecycle-methods-de0e33bf3319">Understanding React Lifecycle Methods</a> was originally published in <a href="https://blog.commutatus.com/">Commutatus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey of success so far]]></title>
            <link>https://blog.commutatus.com/my-journey-of-success-so-far-d341fae858f7?source=rss-c5c7ad067ae5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d341fae858f7</guid>
            <category><![CDATA[internship-experience]]></category>
            <category><![CDATA[startup-life]]></category>
            <category><![CDATA[success-story]]></category>
            <category><![CDATA[placement]]></category>
            <dc:creator><![CDATA[Sarthak Jha]]></dc:creator>
            <pubDate>Mon, 19 Aug 2019 16:33:10 GMT</pubDate>
            <atom:updated>2019-08-19T16:33:10.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*lJDN-D-nhN_2k7Q56nYVew.png" /><figcaption>My map of success</figcaption></figure><p>Placement season huh?</p><p>Yep been there, done that. Not my cup of tea.</p><p>Let’s just say it wasn’t working out at all.</p><p>I understand the plight you are going through right now. Things tend to stay crappy until they just don’t. Since I was in your shoes less than a year ago, I wanted to share a glimpse of my journey, starting from where you are right now to where I am today. Maybe you can take something away from this.</p><h4>College life:</h4><p>My college life wasn’t that great. It was frankly speaking boring, on account of me being boring. Can’t blame the college for that one.</p><p>I can’t speak for others but I didn’t learn a single useful thing during my 4 years of college. Most of the candles were burnt in hanging out with my friends and playing video games.</p><p>But… There’s always a but.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*J32JBG65wR8vv6XFqydA9A.gif" /><figcaption>a but.</figcaption></figure><p>I did start learning HTML/CSS/JS when I was in the 2nd year of the college. Breakups can make people do some crazy stuff, this was one of them. (Thank god for that one breakup 🙏 )</p><p>All my amateur websites are still up on <a href="http://sarthakjha.com/">sarthakjha.com</a>. Feel free to go through them and laugh at me in the comments below.</p><h4>Placements:</h4><p>I am from SRM Ramapuram, a city campus of the main SRM University in the outskirts of the city.. Our placement examinations were held in the main campus, which is about a 45 min ride away by local train. We used to wake up every morning, drag ourselves over to main campus, get rejected, and come back to Ramapuram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nfIX_bHt3QvA0J9Du3_lTA.jpeg" /><figcaption>Edited for NSFW reasons</figcaption></figure><p>Rise, Rinse and Repeat.</p><p>This happened for about 2 months. Each and every day.</p><p>I attempted to crack the selection process of about 20+ companies. And then came “Commutatus”. ⭐️</p><p>Well, what can I say? The 21st time is the charm huh!</p><p>So, Commutatus, the company I’m working for, had 4 rounds in their selection procedure.</p><ul><li>Aptitude examination</li><li>Overnight assignment</li><li>Case study</li><li>Final interview</li></ul><p><strong>AND THE STUPID ME COULDN’T CLEAR THE FIRST ROUND!!! </strong>🤦</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*RnDU3r2yKAlLFT_k5bWicA.png" /><figcaption>Before</figcaption></figure><p>Yeah yeah yeah. I know. “How did you get in otherwise?”</p><p>Well Well Well 😎. Remember the amateur website I mentioned in the last section, <a href="http://sarthakjha.com/">Sarthakjha.com</a>?</p><p>I knew that this could help me make a strong case for making up for not getting through the first round and turns out that I was right! What Commutatus was actually looking for was someone who had a keen interest in web-development and who had pursued this while still in college. Since I was one of these people, they readily accepted.</p><p>All I had to do was drop a message to these guys saying that I already built websites before during my college days. Somehow, they had a look at it and I got in!</p><p>The other rounds were a piece of cake!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*ul_we4FzcHLbIXoQs2QZUw.png" /><figcaption>After</figcaption></figure><p>What impressed me the most was that Commutatus doesn’t really follow traditional rules, they will definitely lookout for outliers. If you have what it takes, we’re simply ready to welcome you with open arms.</p><p>All you need to do is show that you are dedicated to making some extra efforts.</p><h4>Selection and Training:</h4><p>The moment I received the acceptance mail was ecstatic. I called my elder sister right away to give her the news. She was half expecting that I’d be asking her for some money. 😆</p><p>Soon we were all summoned to the office. We were given an introduction to the company and all the people and teams. Each one of us was allotted a mentor to help smoothen the process of integration. Then we celebrated with a joining party at a local club in Chennai and then began our training.</p><p>We started with basic HTML/CSS/JS and later moved on to Ruby on Rails. Irrespective of what field of engineering we came from, the training is given to everyone at the same level so that every recruit had a holistic understanding of both Frontend and Backend. This really helped us later on when we started working on realtime projects as it gave us an understanding of how exactly to plan a feature in a product.</p><p>Once we were done with it, we were allotted Frontend/Backend teams according to our interests and skills gained during our training period.</p><p>I got into the FourthSquad of Commutatus. (More about us later.)</p><p>What I am trying to say is that unlike MNCs, there’s no bench here. All we got are some pretty comfy chairs and a few stools. We all carefully place our butts over them and start working.</p><p>You’ll learn and grow by a huge margin. As of right now, I’m working on the most in-demand FrontEnd framework, React and React Native. Most of my work has been on React Native, making apps for both IOS and Android. My skills went from a solid 3/10 to an almost 7-ish/10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J67zEJ8nLFUaGW13VZM0iA.jpeg" /><figcaption>FourthSquad</figcaption></figure><p>As I mentioned earlier, I was assigned to the FourthSquad of Commutatus. The React Team, aka The Best Team, aka The Fittest Team, aka The Sharpest Looking Team, the “We Get Shit Done” Team.</p><p>We’re a team of 5. Everyone is young and seems to have a decent sense of humor. So we all get along quite fine. We work together, code together, celebrate together and have lots of fun together.</p><p>Oh, did I mention that our team is responsible for the internal global AIESEC website and apps?</p><p>It’s an honor to work along with them. They’ve taught me a lot. It’s a sweet little family we have here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YKWJdQd8wiJEbLowEOehcw.jpeg" /></figure><h4>Work culture</h4><p>Commutatus has an employee-centric model of work culture. They invest heavily in each and every one of us. Weirdly enough, fitness is a huge concern in the office. As of now, we’ve got this 100 push-ups a day challenge going on in the office.</p><p>We also play sports every Thursday. It’s usually football, cricket, badminton or sometimes we switch up and go for a movie instead!</p><p>Fridays are the most chill days at the office. We wrap up work early and have something called “Friday Talks”. It is a space where we can share our passions with the entire office. Commutatus employees pick a topic that they are really passionate about or interested in and then share it with the whole team. We recently had an hour long presentation on “The History of Memes”. Friday talks are generally accompanied by beers and fruit juices sponsored by our CEO, Mike.</p><p>Then we have ComCon. It’s a yearly event, where we close up office, ride off to some distant spot to chill and relax for a few days. The whole company gets aligned with the goals and initiatives of the company and celebrate the previous year’s successes. This year we traveled to Yercaud. It was an amazing experience.</p><p>Last but not least, we’ve got Tiger. I saved the best for the last.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*CIBPkC37qPP6hvQXh7dFOA.gif" /></figure><p>Nope. Not this Tiger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upa7Q7DCkCuo-sAwHCDeHw.png" /></figure><p>Meet <a href="http://bit.ly/tiger-the-office-cat">Tiger</a>. He’s our office pet. As you might have noticed, he’s a cat. And we love playing with him. Play with this sweet little thing to bust away all your stress of the day.</p><h4>Summary:</h4><p>It hasn’t exactly been a cakewalk, but I would say that it was all simply worth it. You might be really stressed right now. Even afraid maybe. And it’s okay to be. But know this, you’ll be successful. Sooner or later, It’s bound to happen. So don’t give up. Keep pushing yourself and one fine day, you’ll reach your goal.</p><p>Coming to <a href="http://www.commutatus.com/">Commutatus</a>, it’s the best thing that can happen to a fresher. Join us and you’ll see it for yourself. Not even kidding. We’ll be waiting for you. See ya guys in the office.</p><p>Here’s a doggo gif for no reason at all:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*8DwoOg6vbhKbf8b9xvbk5g.gif" /></figure><p><em>Feel free to contact me at sarthak@commutatus.com if you have any queries. Bye! </em>😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d341fae858f7" width="1" height="1" alt=""><hr><p><a href="https://blog.commutatus.com/my-journey-of-success-so-far-d341fae858f7">My Journey of success so far</a> was originally published in <a href="https://blog.commutatus.com/">Commutatus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>