<?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 Jishaal Kalyan on Medium]]></title>
        <description><![CDATA[Stories by Jishaal Kalyan on Medium]]></description>
        <link>https://medium.com/@jishaal?source=rss-ee28514003df------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*n8xEEZFFRYkAmjn7OvlcjA.jpeg</url>
            <title>Stories by Jishaal Kalyan on Medium</title>
            <link>https://medium.com/@jishaal?source=rss-ee28514003df------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 08:57:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jishaal/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[RetweetJS #4]]></title>
            <link>https://medium.com/@jishaal/retweetjs-4-8e4fb89c48a7?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e4fb89c48a7</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Mon, 08 Oct 2018 20:27:41 GMT</pubDate>
            <atom:updated>2018-10-08T20:27:41.539Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYHsBKaTpEtygWiIPJzU6w.png" /></figure><p><em>A weekly(ish) digest of notable JavaScript related tweets from my Twitter bubble</em></p><p>In this RTJS, we have a few more tips to make your development life easier! Enjoy!</p><h3>🌳 Log this II</h3><p>Similar to the implicit return trick mentioned <a href="https://medium.com/@jishaal/retweetjs-2-42f0fe670214">in the first RTJS</a>, this tip from <a href="https://medium.com/u/86a55cd7983b">Wes Bos</a> lets you easily log values when traversing and modifying an array.</p><h3>Wes Bos on Twitter</h3><p>🔥 If you are trying to debug something in the middle of chaining array methods, just map over it, console.log, and return it. Since console.log returns nothing, it will just pass the entire array through. You can even make a handle little debug function 🐛</p><h3>✅ Yes or No</h3><p>Name things well and future you will thank yourself. Cheers <a href="https://medium.com/u/829a804ea5da">Samantha Ming</a>!</p><h3>Samantha Ming on Twitter</h3><p>Better Boolean Variable Names 👏 Coming up with good variable names can be a challenge. For boolean values, you can follow this convention. Prefix it with `is`, `has`, or `can`. Just by reading the name, you&#39;ll know it&#39;s a boolean 👍 #100DaysOfCode #CodeNewbie #301DaysOfCode</p><h3>📦 Pass the parcel</h3><p>A neat tip from <a href="https://medium.com/u/4052582a8a85">Travis Arnold</a> that shows how we can use React’s forwardRef API to neatly expose component internals.</p><h3>Travis Arnold on Twitter</h3><p>Playing around with the forwardRef API. Pretty sweet for keeping things private and only exposing what you want people to be able to do with a ref.</p><p>That’s it for another iteration of RetweetJS. Make sure to share with your friends and colleagues!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e4fb89c48a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is function.length?]]></title>
            <link>https://medium.com/@jishaal/what-is-function-length-ece130546fee?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/ece130546fee</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Wed, 19 Sep 2018 20:50:55 GMT</pubDate>
            <atom:updated>2018-09-19T20:50:55.258Z</atom:updated>
            <content:encoded><![CDATA[<p>A colleague and I recently came across code that used the .length property on a function. This got us asking what this value actually referred to, so I decided to look up the fantastic <a href="https://developer.mozilla.org/en-US/">MDN web docs</a> for some info.</p><h4>What does it do?</h4><p>I discovered that <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length">function.length</a> is similar to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/length">arguments.length</a> but it gives you back the number of arguments a function expects, rather than what is actually passed in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*K3tJJKryxVNVa2JV3Nb_HQ.png" /></figure><h4>But wait, there’s a catch</h4><p>Like almost anything in JavaScript, there is always some quirky behaviour that one needs to be aware of 😓</p><blockquote>This number excludes the rest parameters and only includes parameters before the first one with a default value — MDN</blockquote><p>It turns out that rest parameters as well as defaulted parameters do not count towards this number. But what is <em>more </em>interesting is that as soon as a parameter is defined to have a default value within a function, the function.length property only returns the count of parameters that appear before that defaulted parameter, i.e. all following parameters do not count towards the <em>expected </em>arguments<em>. </em>So we see the behaviour below 🤯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*AMmld3xeH8_pu-ovRpvnuw.png" /></figure><h4>Should I use this?</h4><p>The behaviour outlined above makes it a fairly unpredictable indication of the number of parameters a function can have. <a href="https://twitter.com/FlavioCorpa/status/1041994408038735872">The original code this was seen in</a> was implementing a curry function, however as we have seen, the function.length would cause errors if any parameter was to be defaulted. Still an interesting API to know and understand nonetheless 🙂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ece130546fee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RetweetJS #3]]></title>
            <link>https://medium.com/@jishaal/retweetjs-3-cea28b54db84?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/cea28b54db84</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Sun, 16 Sep 2018 22:15:12 GMT</pubDate>
            <atom:updated>2018-09-16T22:15:12.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFxeE5s1rU2EzBgy5WvNPw.png" /></figure><p><em>A weekly(ish) digest of notable JavaScript related tweets from my Twitter bubble</em></p><p>In this RTJS, we have a couple of handy development tips plus code examples of some upcoming React goodness</p><h3>🌳 Make logging easy</h3><p>For VSCode users, here’s a handy keyboard shortcut that allow you to quickly add a console.log to your code</p><h3>Dennis Brotzky on Twitter</h3><p>@JoshWComeau Add this to your VS Code keybindings.json [ { &quot;key&quot;: &quot;cmd+shift+c&quot;, &quot;command&quot;: &quot;editor.action.insertSnippet&quot;, &quot;args&quot;: { &quot;snippet&quot;: &quot;console.log(${1:}$SELECTION);${0}&quot; } } ] never type console.log() again! It&#39;s the first thing I add to editors.</p><h3>✋ Easy delay</h3><p>Create a quick delay function in 5 lines</p><h3>James K Nelson on Twitter</h3><p>Ever wished that `setTimeout` returned a promise? The `delay` function maps `setTimeout` to a promise-based API in just 5 lines, and works with the new async/await syntax too! I&#39;ll be covering how this works in my new async #JavaScript course. The first part is almost ready...</p><h3>⌛ Time slicing</h3><p>An example of the upcoming time slicing API in React. Looks neat!</p><h3>Dan Abramov on Twitter</h3><p>One aspect of Time Slicing which I haven&#39;t demoed at JSConf is pre-rendering. I think it&#39;s one of the most interesting upcoming features in concurrent React though. I wrote up an explanation of what it lets you do: https://t.co/2rCoIIJOfF</p><h3>🐴 Use every language feature</h3><p>A great example of why trying to use every language feature isn’t necessarily a good thing</p><h3>Jake Archibald on Twitter</h3><p>https://t.co/RcOjcvXo39</p><p>That’s it for this third iteration of RTJS! 😀 If you enjoyed it, make sure to share these bite-sized learnings with you friends!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cea28b54db84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RetweetJS #2]]></title>
            <link>https://medium.com/@jishaal/retweetjs-2-42f0fe670214?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/42f0fe670214</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Tue, 28 Aug 2018 08:07:57 GMT</pubDate>
            <atom:updated>2018-08-28T08:07:57.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFxeE5s1rU2EzBgy5WvNPw.png" /></figure><p><em>A weekly(ish) digest of notable JavaScript related tweets from my Twitter bubble</em></p><p>This week, we have a handy Webpack tip as well as some food for thought around best practices with ES6 module syntax. Enjoy!</p><h3>✔ TypeScript without TypeScript</h3><p>Make writing Webpack configs a bit more sane by using adding a type definition module and some comments. Quite neat if you don’t use TypeScript but would like some auto-completion support.</p><h3>Pine on Twitter</h3><p>All it takes to add auto-completion and type-checking to your webpack.config.js: - yarn add -D @types/webpack - //@ts-check - /** @type webpack.Configuration */ #webpack #typescript https://t.co/qtbg9lco5Q</p><h3>🤯 VSCode in the browser</h3><p><a href="https://medium.com/u/ee6691f0bd65">Ives van Hoorne</a> is the creator of <a href="https://codesandbox.io/">CodeSandbox</a>. He tweeted this gem where he managed to get Visual Studio Code running within the browser. Wow!</p><h3>Ives van Hoorne on Twitter</h3><p>I got @code working in the browser! This is not only Monaco, this is VSCode itself directly running in the browser with node shims connected to the APIs of CodeSandbox. This means that we can get Grid View, VSCode Extension support, breadcrumbs + more! I&#39;m so excited by this! https://t.co/RhQcJEduD4</p><h3>🤔 To default export or not to default export</h3><p>Some reasons to always use named exports over default.</p><h3>basarat on Twitter</h3><p>export default considered harmful: https://t.co/3coUmNvp5g #RT if you agree #JavaScript #TypeScript #Node #CommonJS #React #Angular #Vue 🌹</p><p>That’s it for this second week of RTJS! Thanks for reading and do leave feedback if you enjoy this format 😀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42f0fe670214" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RetweetJS #1]]></title>
            <link>https://medium.com/@jishaal/retweetjs-1-2018-08-19-94c2b97c79d0?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/94c2b97c79d0</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Sun, 19 Aug 2018 09:13:44 GMT</pubDate>
            <atom:updated>2018-08-26T05:42:09.440Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFxeE5s1rU2EzBgy5WvNPw.png" /></figure><p><em>A weekly(ish) digest of notable JavaScript related tweets from my Twitter bubble</em></p><p>This week, we have two handy tips that will make your development life a little easier PLUS a surprising revelation about Facebook’s codebase that you don’t want to miss! Enjoy!</p><h3>❌ Don’t mutate me</h3><p>A tiny utility snippet to delete a key from an object without mutating the underlying data structure.</p><h3>A. Sharif on Twitter</h3><p>Just realized that we don&#39;t need much to create a safe remove function in JavaScript *. * Maybe not the best option when dealing with large objects, but this works. https://t.co/r6IAeuX4oN</p><h3>🙈 New monkey, old tricks</h3><p><strong>@qequop</strong> asks if monkey-patching old React APIs to allow compatibility with outdated dependencies is legit. Turns out Facebook internally resort to the same solution. 👏</p><h3>pequop on Twitter</h3><p>@dan_abramov One of my dependencies is built for React 14. Is there anything Very Bad about me doing this?</p><h3>Dan Abramov on Twitter</h3><p>If you ever feel guilty about hacky upgrades... don&#39;t. https://t.co/yUkfHmhCgC</p><h3>😏 Log this</h3><p>Handy tip for when you’re using arrow functions with an implicit return and need to log a value.</p><h3>Kitze on Twitter</h3><p>This is seriously my favorite JS tip. Don&#39;t convert an arrow function just to add a console.log, you can add it with || and then get rid of it later 😍 https://t.co/hVxhkOhz94</p><p>That’s it for this week! I’m keen to keep it as a regular thing so do let me know in the comments if you find this useful 😀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94c2b97c79d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The value of Twitter and other networks]]></title>
            <link>https://medium.com/@jishaal/the-value-of-twitter-and-other-networks-7b487aa49d17?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b487aa49d17</guid>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[twitter]]></category>
            <category><![CDATA[community]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Wed, 05 Apr 2017 05:46:24 GMT</pubDate>
            <atom:updated>2017-04-05T05:46:24.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLr4dnvySUwPc7fRL4AD9g.jpeg" /></figure><p>A couple of weeks ago, I ran into a technical problem at work — something that isn’t too uncommon for your everyday developer. It involved attempting to debug a locally built JavaScript file proxied via a remote environment using <a href="https://www.charlesproxy.com/">Charles Proxy</a>. A few settings had changed on the external resource that is hosted in an Amazon S3 bucket that meant that this workflow had suddenly stopped working.</p><p>As every developer has probably experienced, blockers can be frustrating. Luckily I knew of a developer who had recently tinkered with <a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS</a> configurations on S3 buckets that might know an approach. I pinged him for help over IM, and all that followed happened in a matter of minutes:</p><h3>--INSERT-- on Twitter</h3><p>@charlesproxy is there a place to add/configure response headers (for CORS) when using Map Local? cc @jishaal</p><h3>John Cortexiphan on Twitter</h3><p>@nzjames @charlesproxy @jishaal This is what I normally use for injecting headers etc...</p><h3>Charles Proxy on Twitter</h3><p>@nzjames @jishaal could you DM me an example of what you&#39;d like to add? We are enhancing the Map Local feature.</p><h3>Jishaal Kalyan on Twitter</h3><p>@yakmoose @nzjames @charlesproxy That seems to have worked. Thanks team!</p><p>In less than 10 minutes from the first Tweet being sent I had managed to resolve my issue. Those 10 minutes could have easily been a couple of hours of Googling and tinkering to get a solution. Sure, I may have learned more if I hadn’t reached out for help, but often taking a pragmatic approach can turn out to be more valuable. How awesome was this though? A crowdsourced solution to a very specific problem!</p><h3>Since ‘09</h3><p>This got me thinking about how much I‘ve become reliant on Twitter. Back in 2009 when I had first joined this social platform, it was a place to post some inane thoughts. An inferior Facebook limited by 140 characters of text. Only a few of my friends ever joined the site and so my account remained fairly dormant. But the last few years has dramatically changed the way I use Twitter. It has become one of my primary news feeds; a secondary communication hub for work; a bookmarking tool (until stars became likes — still not happy about that one); a place to find a good meme or gif; and a place to make new friends. It’s a source of information where I know I will find at least something of value during a session of browsing.</p><p>Constant innovation in the software community makes it difficult to keep up with the latest trends and ideas. Today I came across <a href="https://polished.js.org/">three</a> <a href="https://github.com/sindresorhus/create-dmg">new</a> <a href="https://github.com/jevakallio/redux-offline">tools</a>; tomorrow, there will be a few more. I find that this way of using Twitter allows me to easily keep up with these latest innovative ideas by following specific people in the industry. Regularly I see interesting conversations between developers. Although often it’s just casual banter, there have been times where these conversations have resulted in important decisions that have wider impact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4ZHi95yKoqnCwOcviI3Vg.png" /><figcaption>Tweetdeck — allows easier browsing of personalised Twitter streams</figcaption></figure><h3>Not just Twitter</h3><p>Using something as fast-paced as Twitter to keep up with a fast-paced industry can be hard, but that’s the part I enjoy the most. However, it isn’t the only medium that I interact and source information from. Reddit is another service that I frequently use which has lead to lots of interesting discoveries. It follows the style of your more traditional message board, allowing you to subscribe to topic-based forums (called subreddits) such as <a href="https://www.reddit.com/r/programming">r/programming</a> or <a href="https://www.reddit.com/r/webdev/">r/webdev</a>.</p><p><a href="https://slack.com/">Slack</a> and <a href="https://discordapp.com/">Discord</a> are also becoming more commonplace. Both these tools were intended for entirely different use cases— Slack for workplace communication, and Discord for multiplayer gaming. However, both these tools have been used instead to form communities around specific technologies and topics. <a href="https://www.reactiflux.com/">Reactiflux</a> is an example of a chat community that I‘ve joined recently and is full of developers from over the world talking about all things <a href="https://facebook.github.io/react/">React</a> and JavaScript.</p><p>These communities don’t just stop at online communication, in fact, face-to-face interaction in the tech community has been made popular through <a href="https://www.meetup.com/">meetup</a>s and conferences. The advantages of these are that they are more personal, allowing you to ask questions, receive feedback and build professional networks that go further than pixels on a screen. I personally find these ‘networks’ incredibly valuable, irreplaceable by any form of online forum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nI3p-7WM-eWz6asTDi_nnw.png" /><figcaption>The #react-native channel in Reactiflux, a chat community on Discord</figcaption></figure><h3>Final Thought</h3><p>Twitter, along with a range of other networks, provide new ways to engage with individuals and groups that are relevant to both your professional and personal interests. While these avenues may not be for everyone, for me, they have created valuable new channels in which to learn from as well as engage with the wider community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b487aa49d17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The three ‘R’s, Refactoring, React and Redux for robust async JS]]></title>
            <link>https://devblog.xero.com/the-three-rs-refactoring-react-and-redux-for-robust-async-js-252648a8632f?source=rss-ee28514003df------2</link>
            <guid isPermaLink="false">https://medium.com/p/252648a8632f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[redux-saga]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Jishaal Kalyan]]></dc:creator>
            <pubDate>Wed, 04 Jan 2017 20:48:35 GMT</pubDate>
            <atom:updated>2019-06-26T23:07:35.727Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Over a million small businesses, and their advisors are looking for the best cloud apps that integrate with Xero. </em><a href="https://developer.xero.com/partner/app-partner?utm_source=Medium&amp;utm_medium=Blog&amp;utm_campaign=content_marketing"><em>Partner with us</em></a><em>, and we’ll make sure they find yours.</em></p><p>The previous <a href="https://devblog.xero.com/a-saga-that-led-xero-to-redux-aa1361b9a800#.k5d5tjvjf">two</a> <a href="https://devblog.xero.com/learning-and-scaling-a-react-redux-app-with-a-distributed-team-e4c397def187#.faj7m031u">articles</a> in this series highlighted how frontend development practices at Xero have evolved over the past decade, and how we have resorted to building complex applications using React and Redux. With building any application at scale, user-interactions that lead to a number of side-effects are unavoidable. This article will focus specifically on how we have come to use Redux Saga to manage these side-effects.</p><h4>Early patterns</h4><p>During the initial implementation of applications at Xero, the theme was to handle side-effect driven functionality in the lifecycle methods of React components. A common example of this was activating an asynchronous API call to fetch some data in componentDidMount(). While code in this form is not necessarily incorrect, it has the potential to make components more complex than they should be. This has a flow-on effect to the testability and maintainability of the component in-hand, where business logic is tied to the view/render layer.</p><p>Therefore if components are only concerned with rendering and dispatching actions while reducers are pure functions that calculate a new state, then where can impure business logic live? A code review from some Xero developers with more React and Redux experience led to a strong recommendation that instance lifecycle methods were not the place to call APIs, and we should look at middleware for Redux. We settled on using Redux Saga to encapsulate all of our business logic and haven’t looked back since.</p><p>The first uses of sagas we implemented were simple API fetch calls, such as the example below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7418ec5c26baecdf122dbe72dd6c33ad/href">https://medium.com/media/7418ec5c26baecdf122dbe72dd6c33ad/href</a></iframe><p>While the above example is self-contained and simple — making an API call and dealing with the response — evolving requirements quickly led to far more bloated sagas which were both less readable and less testable. Immediately there were many different paths through the code (due to nested control blocks), which led to multiple test cases without even beginning to test the actual functionality (for example data being correctly defaulted/overridden). Additionally, while saga tests are conceptually quite simple, they require a large amount of boilerplate (as every step needs to be run using sagaFunction.next()).</p><h4>Modularize and compose</h4><p>The solution was to split the saga into smaller, more functional blocks (which live in the same file), as in general they are concerned with a single user interaction (for example creating an invoice) and are only exported for testing purposes. Splitting them made tests simpler, more modular and easier to understand. Even createInvoice(), which kicks off the saga chain, only really needs to test ‘can create’ logic, and that appropriate sagas are run in each case.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dca52f1be7205f894d6fd24892374a7c/href">https://medium.com/media/dca52f1be7205f894d6fd24892374a7c/href</a></iframe><p>But, before we go too deep into modularizing each and every part of a saga’s functionality, isn’t there a risk we’ll end up right where we were 5–10 years ago with spaghetti functions, ‘callback hell’ and totally unreadable code? The beauty of Redux Saga (or more generally generator functions) is that ‘forking’ to another saga still maintains unidirectional flow. With considered use of fork and call functions, side-effects can be controlled and dealt with whilst maintaining a logical unidirectional flow.</p><h4>Sharing and collaborating</h4><p>At this point we had another opportunity to share our work with other teams, and get another perspective. This was a rewarding process, which highlighted that perhaps modularization of sagas detracted from the developer’s way of looking at them — as a function representing a single user interaction with a unidirectional flow to match.</p><p>Conversely, this conversation highlighted that there certainly are cases for more modular sagas, as we gained exposure to other team’s implementations. The examples below shows the end result of a discussion we had with the Xero Dashboard project team, who created the complex saga we covered <a href="https://devblog.xero.com/a-saga-that-led-xero-to-redux-aa1361b9a800#.6wykgqwm6">back in article one</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff37b25733b936332eb5132eceb8cfc4/href">https://medium.com/media/ff37b25733b936332eb5132eceb8cfc4/href</a></iframe><p>As you can see, this single saga has a lot of responsibilities. Applying our thinking on modularizing large sagas we can fork sagas, doPolling, and bankSecurityChallenge, which were originally part of the single extended saga. Both contain API calls and varied logic themselves, which made the single saga long, less readable, and involved a large amount of boilerplate code in each test. By breaking these apart, we can now also test each saga function separately.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fbe9fed9626bc77bae765a03b7f6de2/href">https://medium.com/media/1fbe9fed9626bc77bae765a03b7f6de2/href</a></iframe><p>As you can see, feedback and discussion in this way was extremely rewarding, as it brought to light limitations in different team’s implementation of the Redux Saga library. Even more so, it helped get the ball rolling towards a more cohesive, cross-team concept of saga best practice, which should ultimately improve company-wide understanding and implementation of sagas, among other frontend tools and modules.</p><h4>Evolving frontend practices</h4><p>Throughout the three articles in this series, we have covered a decade worth of frontend practices at Xero. The past year has seen the most significant change in frontend in our nearly 10 year history. From rebuilding old parts such as the Xero Dashboard, to completely new projects such as Xero HQ, and the introduction of a common pattern library, we are moving toward a more cohesive experience for not only our developers, but also our users. As a team, we have great confidence in our current stack of tools and how it has made developing complex user-interfaces easier and quicker. As the state of frontend evolves, we aim to evolve with it. The saga continues.</p><p><em>Special thanks to my fellow colleagues </em><a href="https://devblog.xero.com/@mbudm"><em>Steve Roberts</em></a><em> and </em><a href="https://devblog.xero.com/@andy__carrell"><em>Andrew Carell</em></a><em> for collaborating on this article.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=252648a8632f" width="1" height="1" alt=""><hr><p><a href="https://devblog.xero.com/the-three-rs-refactoring-react-and-redux-for-robust-async-js-252648a8632f">The three ‘R’s, Refactoring, React and Redux for robust async JS</a> was originally published in <a href="https://devblog.xero.com/">Xero Developer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>