<?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 Surajit Mukherjee on Medium]]></title>
        <description><![CDATA[Stories by Surajit Mukherjee on Medium]]></description>
        <link>https://medium.com/@Surajit09?source=rss-c47ba362f174------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*RuJ26pxQD0NeQ9W9.jpg</url>
            <title>Stories by Surajit Mukherjee on Medium</title>
            <link>https://medium.com/@Surajit09?source=rss-c47ba362f174------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:20:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Surajit09/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[My quest to learn SPFx]]></title>
            <link>https://medium.com/@Surajit09/my-quest-to-learn-spfx-92ea5f23f957?source=rss-c47ba362f174------2</link>
            <guid isPermaLink="false">https://medium.com/p/92ea5f23f957</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[sharepoint]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Surajit Mukherjee]]></dc:creator>
            <pubDate>Tue, 05 Dec 2017 20:07:06 GMT</pubDate>
            <atom:updated>2017-12-05T20:07:06.038Z</atom:updated>
            <content:encoded><![CDATA[<p>I am trying to learn SharePoint development framework (SPFx) for some time now. Microsoft has put together quite a few different tools in SPFx — Typescript, Gulp, Node etc. When I started using Yeoman generator that built the scaffolding for the project based on SPFx I found that Yeoman hid the complexity of making all these different tools work together.</p><p>In my view the best way to learn SPFx is to learn each of these tools in isolation.</p><p>I started with React, Node and Typescript. Why React? Although React is optional for SPFx based development, I started with React because most apps need a framework like React. There are lot of good courses in Pluralsight and Udemy to learn different aspects of these technologies.</p><p>However, when I was trying to apply my knowledge in SPFx using Yeoman I was still not comfortable because it generated so much code I was a bit clueless how all these came together.</p><p>Sometimes it pays to go back to the basics in this kind of scenario. So I decided to write a simple app based on React and TypeScript and then compare the code with the code genereated by Yeoman. I thought it would be a great idea to convert an existing app so that I could focus on the code instead of thinking about the functionality. Sometime back, I watched a great course — “Modern React with Redux” by Stephen Grider on Udemy. Here is the link to his course:</p><p><a href="https://www.udemy.com/react-redux/learn/v4/overview">Modern React with Redux | Udemy</a></p><p>In this tutorial, he has shown how to build a YouTube search app which I developed as I watched the course. I thought this app had all the basic functionality I needed to apply in a SPFx app. So I decided to convert the app in Typescript. You can find the link to the Typescript app I built here</p><p><a href="https://github.com/surajit09/YoutubeSearchApp">https://github.com/surajit09/YoutubeSearchApp</a></p><p>I thought this would be straightforward but it was not very simple. I had to think how to apply some Typescript concepts in this React app. Surprisingly, I did not find many examples of similar fully functional apps based on React and Typescript.</p><p>In the end, I really learned some good concepts which I have listed below:</p><ol><li>I believe it is best to start from the scratch to put together React and Typescript project. I used webpack as the bundler in this project but I will use Gulp as task runner for the future React and TypeScript projects because Gulp comes with Yeoman. Here is a great guide from Typescript site that I followed which will help you to get started: <a href="https://www.typescriptlang.org/docs/handbook/react-&amp;-webpack.html">https://www.typescriptlang.org/docs/handbook/react-&amp;-webpack.html</a></li></ol><p>2. I found that I needed to create interfaces for states and props for React components that includes both classes and pure functions. Sometimes it is really challenging to come up with meaningful types for interface members. When I had no idea about the type I had to fall back on ‘any’ type.</p><p>3. I have used ‘any’ as event type but something like React.FormEvent&lt;HTMlElement&gt; would be more appropriate depending on the context.</p><p>4. Passing call-backs from the top level React component to child components is a fairly common scenario in React. To pass event handlers at two level deep I had to declare an interface for the function at the intermediate level even though I was not invoking the function at that level. This seemed a bit odd. I hope there would be some syntactic sugar for this in the future.</p><p>5. If I need to use any npm package then I have to make sure the type definition file for the package exists. Otherwise, I have to write an ambient module for the package which can take time. For example, I needed a type definition file for youtube-api-search package. Fortunately, Andrew Ross has created one -</p><p><a href="https://github.com/andrew-w-ross/youtube-typescript/blob/master/typings/main/ambient/youtube-api-search/youtube-api-search.d.ts">https://github.com/andrew-w-ross/youtube-typescript/blob/master/typings/main/ambient/youtube-api-search/youtube-api-search.d.ts</a></p><p>6. I had to learn how to include CSS styles. Luckily, it was not difficult in the end.</p><p>Now, the Yeoman generator makes more sense to me. I have a better understanding about the structure of the out-of-the box app generated by Yeoman.</p><p>This was just the begining. My next project would be creating a React -Redux app with Typescript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92ea5f23f957" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>