<?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 vishalShinde on Medium]]></title>
        <description><![CDATA[Stories by vishalShinde on Medium]]></description>
        <link>https://medium.com/@vs1682?source=rss-1152291e1abe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cn3dsGQzDmxslANKhGrQhw@2x.jpeg</url>
            <title>Stories by vishalShinde on Medium</title>
            <link>https://medium.com/@vs1682?source=rss-1152291e1abe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:37:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vs1682/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[Error Boundaries in React v16.0]]></title>
            <link>https://medium.com/hackernoon/error-boundaries-in-react-v16-0-2ab67b780329?source=rss-1152291e1abe------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ab67b780329</guid>
            <category><![CDATA[mit-license]]></category>
            <category><![CDATA[error-boundaries]]></category>
            <category><![CDATA[raja-software-labs]]></category>
            <category><![CDATA[react-v16]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[vishalShinde]]></dc:creator>
            <pubDate>Tue, 03 Oct 2017 14:36:00 GMT</pubDate>
            <atom:updated>2019-05-20T04:27:24.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCdK2059wDnPpTj6bARSwA.png" /></figure><p><a href="https://hackernoon.com/tagged/react">React</a> v16 is out and so it is the new talk of the town. And yes React has migrated to MIT license.</p><p>React v16 has come up with some new features and <strong>Error Boundaries</strong> is one of them. So, this article is all about Error Boundaries like what are they, how to use them and things like that.</p><p>In react, any runtime error during rendering puts React in a broken state and the whole component tree is unmounted from the root and needs a refresh to recover.</p><p>This can be prevented using a special React component called Error Boundaries which provides a fallback UI in case of a runtime error, like try-catch block.</p><p>These components are implemented using a special lifecycle method which catches any error in their child component tree. React v15 had this method with name <strong><em>unstable_handleError</em></strong>, but had very limited support for error boundaries. This unstable_handleError method no longer works as React v16 provided a new method called <strong><em>componentDidCatch</em></strong>.</p><p>Error boundaries catch errors of child components only. Any error within itself will not be caught and the error will propagate the closet Error Boundary above it. And any error not caught by any Error Boundary will propagate to the root and crash/uproot the whole app. Please see the pen and gist below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/702d25c300f42ffdbea5360dd43e22ce/href">https://medium.com/media/702d25c300f42ffdbea5360dd43e22ce/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fvs1682%2Fembed%2Fpreview%2FZXyrZK%3Fheight%3D600%26slug-hash%3DZXyrZK%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fvs1682%2Fpen%2FZXyrZK&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F878067.ZXyrZK.small.ffa1c615-7cfc-4310-a420-f912ae5a7971.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b720ba6058748be765f5424e1ea4d87b/href">https://medium.com/media/b720ba6058748be765f5424e1ea4d87b/href</a></iframe><p>There was a discussion within the React team whether it’s a good idea to keep a corrupted UI than completely remove it. But they have used it in there products. For example, Facebook Messenger wraps content of the sidebar, the info panel, the conversation log, and the message input into separate error boundaries. If some component in one of these UI areas crashes, the rest of them remain interactive.</p><blockquote>It’s totally upto your product’s design.</blockquote><p>React team also encourages to use JS error reporting services so that one can learn about unhandled exceptions as they happen in production, and fix them.</p><h3>Error Stack</h3><p>React v16 prints all errors occurred during rendering to the console in development. In addition to error messages and <a href="https://hackernoon.com/tagged/javascript">javascript</a> stack, it also provides <strong>component stack</strong> so now one can see where exactly the component broke.</p><p>You can also see filenames and line numbers in component stack using babel plugin <a href="https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source">babel-plugin-transform-react-jsx-source</a>.</p><h3>Migration</h3><p>If one is using <em>unstable_handleError </em>from React v15 and want to migrate to React v16, the React team has provided a <a href="https://github.com/reactjs/react-codemod#error-boundaries">codemod</a>.</p><h3>Resources</h3><p><a href="https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html">Error Handling in React v16</a> by Dan Abramov</p><blockquote>I’m currently working on some cool stuff with React at Raja Software Labs, Pune. You can reach me on <a href="https://twitter.com/vs1682">twitter</a>.</blockquote><blockquote>If you liked the article, please hit the clap icon.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ab67b780329" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/error-boundaries-in-react-v16-0-2ab67b780329">Error Boundaries in React v16.0</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why using nested connect(react-redux) components is good?]]></title>
            <link>https://medium.com/hackernoon/why-using-nested-connect-react-redux-components-is-good-bd17997b53d2?source=rss-1152291e1abe------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd17997b53d2</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[connect]]></category>
            <category><![CDATA[raja-software-labs]]></category>
            <dc:creator><![CDATA[vishalShinde]]></dc:creator>
            <pubDate>Tue, 26 Sep 2017 03:51:01 GMT</pubDate>
            <atom:updated>2019-05-20T04:27:25.401Z</atom:updated>
            <content:encoded><![CDATA[<p>We all know how easy it is to manage the state with <a href="https://github.com/reactjs/redux">Redux</a>. It keeps a single source of truth(state tree or store) at the root of the app and it can be changed only by dispatching actions and you can subscribe to those changes to reflect any changes in <a href="https://hackernoon.com/tagged/ui">UI</a>.</p><p>I mainly use <a href="https://hackernoon.com/tagged/redux">Redux</a> with <a href="https://github.com/facebook/react">React</a> where any change in parent’s state or props makes the parent and its children to re-render unless we provide some solution to stop those unwanted re-rendering.</p><p>Now if I subscribe to changes in the store at the parent level, it will make the whole app re-render even if just one child component actually needed to re-render.</p><p>So here comes the <a href="https://github.com/reactjs/react-redux"><strong>react-redux</strong></a> library in picture. It’s helps us connect react and redux in an efficient way using the <strong>connect </strong>method.</p><p>Connect method lets you connect your component to redux store and extract the props you need for your component.</p><p>Here’s an example of how you use connect.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4faa5bcc66d4fd665deacb61827610ca/href">https://medium.com/media/4faa5bcc66d4fd665deacb61827610ca/href</a></iframe><blockquote>From here on whenever I’ll use the word “connect” I’ll mean connect to redux store.</blockquote><p>While working with this library I came across a situation where I wanted to connect a child component of an already connected component. And I was like “<em>is this a good idea?</em>”, “<em>what about the performance and those extra re-renderings, if any?</em>”.</p><p>So after searching through the issues of redux and react-redux libraries on their github repo and lots of googling, I came to a conclusion that it’s perfectly fine to use connected components inside an already connected component. Also it actually boosts the performance of your app.</p><p>Connecting a child component of an already connected component has several advantages.</p><ol><li>Suppose you have a connected component with 100 children components. Now the parent has to provide props to these 100 components and it has to extract and return those props from the store using <strong>mapStateToProps</strong> function. Now your app to be efficient your mapStateToProps function should be efficient and return as soon as possible and extracting props for those 100 children might be a huge task. Now to help parent you can connect a child and let it extract its own props and props for its children. That way you reduce the burden on the parent and pass some of those extracting to the child.</li><li>You may come across a situation where you don’t want the parent to know about the props the child will receive. You can achieve this by connecting the child component and extracting its own props using the mapStateToProps.</li><li>Connect method is actually heavily optimized and it checks for different conditions and decide whether the parent should update and re-render. This way it avoids those unwanted re-renders which would have otherwise impacted the performance heavily.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a95e3dde182124114989cabb12a27171/href">https://medium.com/media/a95e3dde182124114989cabb12a27171/href</a></iframe><blockquote>I’m currently working on some cool stuff with React. You can reach me on <a href="https://twitter.com/vs1682">twitter</a>.</blockquote><blockquote>If you liked the article please click the clap icon. Thanks.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd17997b53d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/why-using-nested-connect-react-redux-components-is-good-bd17997b53d2">Why using nested connect(react-redux) components is good?</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Percentage values of margin, padding and positioning values]]></title>
            <link>https://medium.com/@vs1682/percentage-values-of-margin-padding-and-positioning-values-aa64bae16969?source=rss-1152291e1abe------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa64bae16969</guid>
            <category><![CDATA[margin]]></category>
            <category><![CDATA[percentage-values]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[padding]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[vishalShinde]]></dc:creator>
            <pubDate>Thu, 16 Feb 2017 17:49:49 GMT</pubDate>
            <atom:updated>2017-02-16T17:49:49.800Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I touched the Responsive Web Design part and the first thing I had to learn was to use relative values for most of the things.</p><p>That took me to “How relative values of margin, padding and positioning values are calculated?”.</p><p>Consider the images below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*IE0Pq2Ut49quplcReCiXbg.png" /><figcaption><strong>Parent with size (400x300)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*RZ2KKF115cFhZd_visfLXA.png" /><figcaption><strong>Child with size (100x100) and margin: 20%; padding: 10%;</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*vvQE7Fxep0FTnb_5mGcxYA.png" /><figcaption><strong>Child with sixe(100x100) and top: 10%; left: 10%; bottom: 20%; right: 20%;</strong></figcaption></figure><p>What I learned from my findings is that:</p><ol><li>Percentage value of <strong>margins</strong> are calculated using <strong>width </strong>of<strong> containing box</strong> or <strong>parent.</strong></li><li>Percentage value of <strong>paddings</strong> are calculated using <strong>width</strong> of <strong>containing box</strong> or <strong>parents.</strong></li><li>Percentage value of <strong>top </strong>and<strong> bottom </strong>are calculated using <strong>height</strong> of <strong>containing box</strong> or <strong>parents.</strong></li><li>Percentage value of <strong>left </strong>and<strong> right </strong>are calculated using <strong>width</strong> of <strong>containing box</strong> or <strong>parents.</strong></li></ol><p>For more details check out this pen <a href="http://codepen.io/vs1682/pen/jyRYqO"><em>http://codepen.io/vs1682/pen/jyRYqO</em></a></p><p>Thank You.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa64bae16969" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>