<?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 Jon Hilton on Medium]]></title>
        <description><![CDATA[Stories by Jon Hilton on Medium]]></description>
        <link>https://medium.com/@jon_16396?source=rss-2f0dcde6fc49------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uV7q78uXT1emUcx5o3APlg.jpeg</url>
            <title>Stories by Jon Hilton on Medium</title>
            <link>https://medium.com/@jon_16396?source=rss-2f0dcde6fc49------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:37:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jon_16396/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[Want to move to full-stack development but not sure where to start?]]></title>
            <link>https://medium.com/@jon_16396/want-to-move-to-full-stack-development-but-not-sure-where-to-start-da91d5d22da?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/da91d5d22da</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 14:36:44 GMT</pubDate>
            <atom:updated>2018-11-05T14:36:44.839Z</atom:updated>
            <content:encoded><![CDATA[<p>There was a time when spinning up a web page was simple.</p><p>You’d create an HTML file, include links to your CSS and Javascript, publish to your web server and you were done.</p><p>It’s fair to say things have become a tad more complicated in recent times.</p><p>Now you can’t get far into “front-end” development without running into talk of Node.js, webpack and NPM.</p><p>Then there are the frameworks to deal with. Angular, Vue.js or React.js all bring significant features but even more concepts to learn!</p><p>So what’s a back-end developer to do with all this stuff?</p><p>I find it helps to visualise what’s going on (and, well, who doesn’t love a good diagram?!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*KKUyMROooflLDRwBpEOOQQ.png" /></figure><p>The top bit is the straightforward part. This is where the browser takes your HTML, CSS and Javascript and uses it to render a web page in the browser.</p><p>Everything above the blue dotted line is what’s deployed to your web server and served to the browser when it requests a page.</p><p>The bit below the blue dotted line is where all the complexity creeps in.</p><p>You can think of this as the part which runs on your development machine.</p><p>Let’s break this down a bit.</p><h3>Minification and Bundling</h3><p>These days, we’re building bigger and bigger front-end applications which require more and more code.</p><p>Whilst Internet connections are pretty fast (on the whole) you don’t want to force your visitors to download hundreds of megabytes of javascript before they can use your app.</p><p>To this end, most javascript and CSS these days is <strong>minified</strong>.</p><p>This is the process whereby all the extraneous whitespace, new lines, and long variable/function names etc. in your javascript are either removed or shortened, to make the resulting javascript and css files as small as possible.</p><p>Multiple javascript/css files are often then <strong>bundled</strong> together.</p><p>For example, if you have index.js, about.js and listings.js, these would all be bundled together into one file. The idea being that you can improve the load time of your application (by reducing the number of requests the browser has to make to load it).</p><p><strong>Compilation </strong>is required these days because you may find yourself writing Javascript which uses new(ish) language features which are not supported by all browsers.</p><p>A Javascript compiler can take this javascript and “dumb it down” to a version which the browsers can handle.</p><h3>webpack, parcel and other application bundlers</h3><p>You can think of webpack and co. as build tools for front-end code.</p><p>They can be configured to run your Javascript compilers, bundle and minify your code and all sorts of other “build time” tasks.</p><p>This is where a steep learning curve can kick in for tools like webpack, especially for those of us more familiar with back-end code.</p><p>webpack has it’s own unique syntax (which isn’t always intuitive).</p><p>Here’s an example.</p><pre>module.exports = {<br>  mode: &#39;development&#39;,<br>  entry: &#39;./foo.js&#39;,<br>  output: {<br>    path: path.resolve(__dirname, &#39;dist&#39;),<br>    filename: &#39;foo.bundle.js&#39;<br>  }<br>};</pre><p>And in recent times I’ve found Parcel to be a handy alternative (with much less/no configuration).</p><h3>Javascript Frameworks to the rescue</h3><p>And finally we have the major Javascript frameworks.</p><p>Happily, the teams behind the three major frameworks realise you don’t really want to waste your time configuring (and then debugging) webpack.</p><p>All three now abstract webpack configuration away so you don’t need to worry about it.</p><p>Vue.js and Angular have their own Command Line Interface tools.</p><p>These let you perform common tasks (like spinning up a new project) directly from the command line.</p><p>As you add new features, bring in new dependencies etc. The webpack configuration is handled for you, meaning you never need look at it (unless you really want to!).</p><p>Create React App does a similar job. It’s not a CLI as such, but also abstracts the webpack configuration away.</p><h3>Now what?</h3><p>So that’s the big picture.</p><p>When it comes to the major frameworks they’ve all come on leaps and bounds in terms of letting you quickly spin up new applications so you can get coding.</p><p>But they still have their own learning curves and different approaches to basically the same task (building applications out of smaller components).</p><p>So how can you get building your features?</p><p>Here’s my approach (when learning any of the “big JS frameworks”).</p><ol><li>Come up with ideas for applications you’d like to build (brainstorm as many as you like to start with)</li><li>Pick one that feels small enough to build (but interesting enough to keep you going when it gets difficult!)</li><li>List as many features as you can think of (again, don’t filter at this point, that comes next)</li><li>Now pick one tiny feature (keep it really small and simple to start with)</li></ol><p>Now your challenge is to learn just enough to build that feature.</p><p>Simple features win, so displaying some text or a heading is a winner.</p><p>From there, taking some kind of input and updating the user interface is a good next step.</p><p>All the frameworks have pretty good docs these days so don’t be afraid to jump in and start building :-)</p><p>And if you just don’t have the time or patience to get into front-end development (I hear ya), I’ve written a <a href="https://products.jonhilton.net/front-end-in-four-hours/">handy pocket guide to get you up to speed quickly</a><a href="https://products.jonhilton.net/front-end-in-four-hours/).*">.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da91d5d22da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning React — How to connect React components to your ASP.NET Core Web API]]></title>
            <link>https://medium.com/@jon_16396/learning-react-how-to-connect-react-components-to-your-asp-net-core-web-api-c59066b3e2c0?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/c59066b3e2c0</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Sat, 09 Jun 2018 20:15:32 GMT</pubDate>
            <atom:updated>2018-06-09T20:15:32.629Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@jon_16396/diary-of-a-net-developer-learning-react-5f956721b298">Our first foray into React.JS</a> was going pretty well.</p><p>We’d decided to <a href="https://medium.com/@jon_16396/diary-of-a-net-developer-learning-react-5f956721b298">learn React</a>, started with some <a href="https://medium.com/@jon_16396/learning-react-building-up-the-user-interface-using-components-and-dummy-data-4ba52726b501">basic UI component building </a>and it was going surprisingly smoothly.</p><p>The first few things we’d tried had actually worked! The UI was coming together. I was beginning to feel like da boss!</p><p>Then the inevitable happened, we slammed right into the bit where the docs effectively say “now you’re on your own”.</p><p>We needed to hook our fledgling front-end component up to some real data coming from an ASP.NET Core Web API.</p><p>Unsurprisingly there’s no <strong>specific</strong> advice on how to do this in the React docs (makes sense really, React will work with any backend API and it’s not their place to go into specifics).</p><p>The good news? After a bit of arm-waving and failed experiments we found the simplest way to get this working but first we had to understand a bit about how React handles state.</p><h3>Where to get the data?</h3><p>This is where we’d got to…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/0*nl1Udwl-mWNkh8Co.png" /></figure><p>A bit rudimentary but it displays the data we need.</p><p>The problem is the somewhat static nature of this data…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8159018dbecdc069437bf0a8b47c15aa/href">https://medium.com/media/8159018dbecdc069437bf0a8b47c15aa/href</a></iframe><p>We needed to swap this out with a call to our API.</p><p>Remember our render function looked like this…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7cefd31e9915ea0602ad5f30c5d0f834/href">https://medium.com/media/7cefd31e9915ea0602ad5f30c5d0f834/href</a></iframe><p>React invokes render when this component is first loaded (and at other times, to do with state changing etc. which we’ll come on to).</p><p>Our render method would make the call to getUserData and then render a UserRow for each user.</p><p>So, naively, we could just update getUserData to make an AJAX call right?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1379cdce22cb0c5baf7641c1b51ac71e/href">https://medium.com/media/1379cdce22cb0c5baf7641c1b51ac71e/href</a></iframe><p>This would probably work, but it kind of goes against the ethos of React.</p><p>The more we’ve worked with React the more we’ve really start to appreciate the <strong>declarative way of building components</strong>.</p><p>The idea is that you build a user interface that reacts (yes, really) to state changes in your component.</p><p>So instead of making a call to get data directly from the render method, the React approach would be to make the Ajax call at some point during the lifecycle of the component, update our component’s state and have the UI automatically update to reflect that changed state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bTtugFwoL3zFn__b.png" /></figure><p>Any time we modify this state, the UI should automatically reflect to show the new data.</p><h3>Rendering state</h3><p>To declare initial state (the state your component will use from the get-go, before making any AJAX calls) you can simply declare it like so…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d33edca3c6d769ff1f9dce9c41c46877/href">https://medium.com/media/d33edca3c6d769ff1f9dce9c41c46877/href</a></iframe><p>In effect, we’ve just moved the hard-coded data to React State.</p><p>Now we can do away with our getUserData call and bind to the state instead…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e140952835113e9ce87946da02642adf/href">https://medium.com/media/e140952835113e9ce87946da02642adf/href</a></iframe><p>The reference to this.state.users makes the magic happen. Now whenever that state changes, the relevant parts of the user interface will be updated automatically.</p><h3>The AJAX Call</h3><p>Which leaves us with the last part of the puzzle. Where/when and how to wire up the component to our API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*7TuyOLcCPzERaG3R.png" /></figure><p>The react docs point us in the right direction…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/0*QuEibOru2BeK34XY.png" /></figure><p>ComponentDidMount is automatically invoked by React when the component has loaded. We can make our ajax call in here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03136345326dfc61e51a623c357e473b/href">https://medium.com/media/03136345326dfc61e51a623c357e473b/href</a></iframe><p>Fetch is available “out of the box” with modern browsers and React makes sure it will work in older browsers by employing a <a href="https://remysharp.com/2010/10/08/what-is-a-polyfill">polyfill</a> (other ajax libraries are available).</p><p>Incidentally the following are equivalent.</p><p>this.setState({ users })</p><p>this.setState({ users:users })</p><p>You don’t have to specify the name of the property (‘users’) if it’s the same as the name of the variable.</p><p><strong>Async/Await</strong></p><p>Javascript (and Typescript) support the async/await pattern.</p><p>In this case this means the const users line won’t be invoked until a response has come back from the await fetch() call.</p><p>Under the hood fetch is actually returning a promise. If you’d rather not use async/await you can always just interact with the promise directly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8d4dc82c05d40e0adda74d06831fe11/href">https://medium.com/media/b8d4dc82c05d40e0adda74d06831fe11/href</a></iframe><h3>The API method</h3><p>That’s it, the component will now be rendered using the data returned from the API call.</p><p>For this code to work the names of the properties returned in the API call must match the names you’re using in the javascript.</p><p>Here’s a rough example of an API that would work here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42a627d3834a817f07ad0a5de1a63272/href">https://medium.com/media/42a627d3834a817f07ad0a5de1a63272/href</a></iframe><p>And here’s what the response looks like in the browser (note ASP.NET returns the data using camel case property names, which matches the case we used in the React component).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/0*8TSgnqs3csZ3dgJV.png" /></figure><h3>Next steps</h3><p>This all works, but there’s a strange side-effect of having that initial hard-coded state at the top of the React component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d33edca3c6d769ff1f9dce9c41c46877/href">https://medium.com/media/d33edca3c6d769ff1f9dce9c41c46877/href</a></iframe><p>Looking at this in the browser we see this hardcoded data before the “real” data loads in from the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/0*0jmvA6gYro4SAaQc.gif" /></figure><p>The next post will look at how we removed this initial data and made better use of Typescript to specify the structure of the data returned from the API.</p><p>All posts in the <strong>Learning to use React with ASP.NET Core Web API</strong> series.</p><p><em>Originally published at </em><a href="https://jonhilton.net/connecting-react-to-asp-net-core-web-api/"><em>jonhilton.net</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c59066b3e2c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning React — Building up the user interface using components and dummy data]]></title>
            <link>https://medium.com/@jon_16396/learning-react-building-up-the-user-interface-using-components-and-dummy-data-4ba52726b501?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ba52726b501</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Sat, 09 Jun 2018 20:05:53 GMT</pubDate>
            <atom:updated>2018-06-09T20:05:53.703Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@jon_16396/diary-of-a-net-developer-learning-react-5f956721b298">In the last post</a> you saw how we’d spun up a new React project that would eventually go on to connect to an existing ASP.NET Core Web API.</p><p>We’d got as far as one simple component and needed to finish off our basic interface and hook it up to some data.</p><p>Here’s a quick reminder of what we were aiming for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*B9WVXVM1epdQyU7X.png" /></figure><p>And this is how far we’d got.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*tJD0Uy46SVcQCJcP.png" /></figure><p>So where next?</p><h3>Components all the way down</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/0*q1U8OgbPEh1QYrWt.png" /></figure><p>One of the pillars of React is that <strong>everything is a component</strong>.</p><p>Building any user interface in React boils down to deciding which components you need and what order to build them in.</p><p>Our simple list of users could be one big component with all the markup and logic in one file but React encourages you to break this down.</p><p>A better bet is to build several smaller components, each with one specific role, which you can develop in isolation and then arrange together to form your bigger all singing and dancing feature.</p><p>And when you stop to think about it, this makes perfect sense.</p><p>It’s <strong>flippin difficult to build an entire application in one go</strong>, but break it down into manageable chunks and you’ll find you blitz through the requirements like nobody’s business.</p><h3>Building the user details row</h3><p>With this in mind we set about building a simple component to show user details for each user (as rows in our My Users list).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*aRoKeD0VEsrWtiGm.png" /></figure><p>Here’s what we ended up with.</p><p><strong>UserRow.tsx</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc0b3b13f058fb7577f2dd265922800d/href">https://medium.com/media/fc0b3b13f058fb7577f2dd265922800d/href</a></iframe><p>Here we’re sticking with a simple ethos of getting the key elements in place first before worrying too much about appearance (hence using a simple table; I could easily get lost for days trying to make anything work using CSS!).</p><p>We’re still using hardcoded values and before moving on to real data needed to plug at least one of these rows into our <strong>MyUsers</strong> component.</p><p><strong>MyUsers.tsx</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a3aca01de524d10daba8094f5e7a13f/href">https://medium.com/media/4a3aca01de524d10daba8094f5e7a13f/href</a></iframe><p>A small tweak here to render everything using a table and to bring in our shiny new <strong>UserRow</strong> component.</p><p>We put some minimal css in index.css…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06597b3852766a28a10329e89317e835/href">https://medium.com/media/06597b3852766a28a10329e89317e835/href</a></iframe><p>Checking our progress now gave us this…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*lw5PLc3GT-7y6EPM.png" /></figure><p>So far so good, but what about driving this row from some actual data? (not just hardcoded values in the markup).</p><h3>Props to you</h3><p>We needed to take this…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76d772de4a4f1866161fe09409fc5ea1/href">https://medium.com/media/76d772de4a4f1866161fe09409fc5ea1/href</a></iframe><p>And make it possible to render multiple rows, each with their own values for each cell.</p><p>Now if you’re used to working with ASP.NET MVC and Razor, you’re no doubt used to referencing @Model to render values…</p><pre>&lt;p&gt;Hey @Model.FirstName!&lt;/p&gt;</pre><p>React’s equivalent is “props”…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fddec03f210889e3a609999fa84eb74/href">https://medium.com/media/3fddec03f210889e3a609999fa84eb74/href</a></iframe><p>Assuming we could somehow get that user object into our component, the “name” and “summary” values would be rendered in their correct locations within the markup.</p><p><strong>Exercise caution when cheating with any</strong></p><p>If you’ve used Typescript at all you’ve probably spotted a little bit of cheating going on here…</p><p>React.Component&lt;any, any&gt;</p><p>The first &lt;any, indicates what type our props are.</p><p>By using any we’re basically saying the props can be of any type. Doing this enables us to get something up and running quickly but also removes the type safety we’d otherwise get.</p><p>If we specified a type there instead, the typescript compiler would protect us from ourselves, ensuring we have to pass an object of the right “shape” to our component.</p><p>However this was enough to get us going and we could always add the types once we’d learned the ropes…</p><p>Now we could pass a “user” to our component like so…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c825d89e235f42f30d5580c41574d524/href">https://medium.com/media/c825d89e235f42f30d5580c41574d524/href</a></iframe><p>But what we really needed was generate multiple rows for multiple users…</p><h3>Map (a bit like Linq)</h3><p>To loop over an array of user objects; rendering a UserRow for each one we found we could use javascript’s map function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7cefd31e9915ea0602ad5f30c5d0f834/href">https://medium.com/media/7cefd31e9915ea0602ad5f30c5d0f834/href</a></iframe><p>Not dissimilar to Select in C#, this will loop through the value returned from getUserData() and render a UserRow for each one.</p><p>If you’re wondering what the key attribute is, omit it and React will blow up. This is a special attribute which requires a unique value for each item in the array. React uses this to efficiently render each row and only re-render rows which have changed (when the source data changes).</p><p>Finally we could test this all out with a simple implementation of our getUserData() function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8159018dbecdc069437bf0a8b47c15aa/href">https://medium.com/media/8159018dbecdc069437bf0a8b47c15aa/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/0*cQbwQ1fLkhFBPZQ_.png" /></figure><p>Now our component was coming together.</p><p>We could render as many user rows as we had users; the next step would be to hook this up to our ASP.NET Core Web API.</p><p><em>photo credit: Leo Reynolds </em><a href="http://www.flickr.com/photos/49968232@N00/34442537576"><em>book pile 2017</em></a><em> via </em><a href="http://photopin.com/"><em>photopin</em></a><em> </em><a href="https://creativecommons.org/licenses/by-nc-sa/2.0/"><em>(license)</em></a></p><p><em>Originally published at </em><a href="https://jonhilton.net/building-a-ui-using-react-components/"><em>jonhilton.net</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ba52726b501" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Diary Of A Net Developer — Learning React]]></title>
            <link>https://medium.com/@jon_16396/diary-of-a-net-developer-learning-react-5f956721b298?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f956721b298</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Sat, 09 Jun 2018 19:55:02 GMT</pubDate>
            <atom:updated>2018-06-09T20:07:57.311Z</atom:updated>
            <content:encoded><![CDATA[<p>When Angular 1 first appeared on the scene it felt like a breath of fresh air.</p><p>Suddenly scenarios that were nigh on impossible using MVC (with a sprinkling of AJAX) were achievable; all you really had to do was reference the Angular script on your web pages and you were good to go.</p><p>Fast forward a few years and the javascript/front-end ecosystem has exploded.</p><p>Webpack, Typescript, React, Angular (what version is it now? 6?), Babel, Jasmine, Karma…</p><p>The list goes on and on.</p><p>And therein lies the problem.</p><p>If you’re a C#/ASP.NET developer looking to dip your toe in these choppy waters then you’re faced with an insurmountable mountain of choices and a learning curve that looks suspiciously like a brick wall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*BlnQcAExwvvnEj_v.png" /></figure><p>We’ve just started a new project at my work and after some experiments with different SPAs we’ve settled on React (using Typescript) for our next couple of projects.</p><p>My aim here is to simply document some of the key things we’re picking up as we go along, in the hope it might help others following in our footsteps.</p><p>We ended up choosing React for three important reasons.</p><ol><li>There is a large community to turn to for advice/articles and learning resources</li><li>It’s easy to get started and build something without having to learn some of the peripheral details (like WebPack) from day one</li><li>You can build your app using Typescript, we’ve found the safety that comes from “compile-time” warnings and errors in VS Code invaluable as we fumble our way through these unknown waters</li></ol><h3>Create React App</h3><p>The project we’re working on already has a fully-functional API so we’re just building a front-end. For that reason the front-end project doesn’t need to be an ASP.NET Core project.</p><p>If you’re planning on running React and ASP.NET Core Web API in the same project then you’d probably want to use the <a href="https://docs.microsoft.com/en-us/aspnet/core/spa/react?view=aspnetcore-2.1&amp;tabs=visual-studio">Microsoft template</a> that lets you spin up just such a project.</p><p>So brushing aside ASP.NET Core means we can start off with a straight React project and then make API calls to our existing ASP.NET Core Web API.</p><p>There’s a handy project called Create React App which will take care of most details for you and give you a simpler starting point for your project. It hides some of the details like WebPack away whilst you get started but leaves you free to get into those particular weeds at a later date if you really need/want to.</p><p>We elected to use the <a href="https://github.com/wmonk/create-react-app-typescript">Typescript version</a>.</p><p>So long as you’ve got a recent version of Node and Yarn installed (you can use NPM or Yarn, they are interchangeable) you can install <strong>create-react-app</strong> using this command.</p><pre>yarn global add create-react-app</pre><p>This downloads the create-react-app dependency to a global directory on your machine so you can use it in any command prompt (irrespective of which folder you’re currently in).</p><p>Once yarn’s done its thing you can create a new React Typescript app with this command…</p><pre>create-react-app your-app-name --scripts-version=react-scripts-ts</pre><p>Then change directory and use yarn to start the app…</p><pre>cd your-app-name <br>yarn start</pre><p>If all goes well you’ll see something like this…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*8OQiA45Ikz1uVqeQ.png" /></figure><p>And this should appear in your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*HQJ8iD-OmzwIDSSN.png" /></figure><p>If you’ve tried creating any front-end apps recently (Angular, Aurelia etc.) then you’re probably used to seeing starter projects looking pretty bloated from the get go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/0*P_9gQDN88lksIz5g.png" /></figure><p>By those standards this is relatively lean…</p><h3>A first component</h3><p>Keen to crack on from this point we eagerly set about building our first component.</p><p>Before we started working on the actual project we did a bit of research and actually found the <a href="https://reactjs.org/tutorial/tutorial.html">getting started tutorial over at reactjs.org</a> to be really helpful to get some of the basic concepts in our minds before we started for real.</p><p>For our project we needed to build a simple list component, something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*sPGe5sPPZ-8Z4lk8.png" /></figure><p>I’ve changed the details of what we were actually building so as to protect our client but this matches the structure of what we were aiming for.</p><p>So where to start?</p><p>Everything in a fresh create-react-app starts at the very top of the app, in src/index.tsx where we find this code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76f2ac05a135b09bfacc58588cf29bf5/href">https://medium.com/media/76f2ac05a135b09bfacc58588cf29bf5/href</a></iframe><p>This instructs React to render the App component in an element on our page (#root).</p><p>To get going quickly we decided to ignore the existing App component referenced here (which simply renders the “Welcome to React” page we saw earlier) and create our own.</p><p>The “React” way to build applications is using components. With that in mind we took another look at our mockup and identified the key parts that might warrant their own component.</p><p>We settled on these components…</p><ul><li>My Users (the parent component)</li><li>User Details Row</li><li>Avatar (the image on each row)</li><li>Tasks Button (the button on each row)</li></ul><p>So we’d render the “My Users” component, which in turn would render one or more “User Details Rows” which would also include the Avatar and Tasks Button components.</p><p>Starting at the top we created this “My Users” component.</p><p><strong>src\MyUsers.tsx</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4f88a896badcd00abade69f3300924e/href">https://medium.com/media/f4f88a896badcd00abade69f3300924e/href</a></iframe><p>This is about as simple as we could get for starters.</p><p>By extending React.Component we get to create a render method which then renders the relevant markup for our component.</p><p>That funny looking “html” in the javascript is actually a kind of XML syntax (called JSX) which React then converts to javascript under the hood. In case you’re interested, the underlying javascript looks like this…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da1b5212f136028ed6226580902863a4/href">https://medium.com/media/da1b5212f136028ed6226580902863a4/href</a></iframe><p>But in truth you generally don’t need to worry about that and can stick to the handy JSX code above.</p><p>With that component in place we just needed to render it.</p><p><strong>src\Index.tsx</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8820597cc09422c91a5c07d0372ba78/href">https://medium.com/media/e8820597cc09422c91a5c07d0372ba78/href</a></iframe><p>Gone is the reference to App and in its place is our MyUsers component.</p><p><strong>Handy Tip</strong></p><p>If you’re using Visual Studio Code to work on your React App…</p><p>When you reference something like MyUsers (see above) without bringing in a reference, VS Code will prompt you (with the lightbulb icon).</p><p>Select one of the options to automatically add the reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/0*1Zr8ayfn_uuzDICl.png" /></figure><p>Because we ran yarn start earlier, the changes to the app were automatically reflected in the browser meaning we could now review our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*SD5U48-NG4Tdpk3p.png" /></figure><p>Granted we’re not winning any design awards for this one but it’s a solid start.</p><p><a href="https://medium.com/@jon_16396/learning-react-building-up-the-user-interface-using-components-and-dummy-data-4ba52726b501">Next time I’ll cover how we built up the next few components</a> and started plugging in some (initially fake) data.</p><p><em>Note, this depiction of events is not entirely accurate; sequences shortened and cursing omitted ;-)</em></p><p><em>photo credit: WanderingtheWorld (www.ChrisFord.com) </em><a href="http://www.flickr.com/photos/44028103@N07/14212558927"><em>‘Vines’, United States, New York, New York City</em></a><em> via </em><a href="http://photopin.com/"><em>photopin</em></a><em> </em><a href="https://creativecommons.org/licenses/by-nc/2.0/"><em>(license)</em></a></p><p><em>Originally published at </em><a href="https://jonhilton.net/diary-of-a-dot-net-developer-learning-react/"><em>jonhilton.net</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f956721b298" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MVC vs Razor Pages — A quick comparison]]></title>
            <link>https://medium.com/@jon_16396/mvc-vs-razor-pages-a-quick-comparison-d9131ed5691a?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9131ed5691a</guid>
            <category><![CDATA[aspnet-development]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[aspnet-mvc]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Thu, 26 Apr 2018 13:26:08 GMT</pubDate>
            <atom:updated>2018-04-26T13:26:08.777Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>I’m trying to learn ASP.NET but am really confused. All the tutorials seem to conflict with each other over whether I should be using MVC or Razor Pages?</em></blockquote><p>If you’re learning ASP.NET in this brave new .NET Core world and you want to build server-side web applications then it’s a straight fight between two contenders.</p><p><em>Just to be clear, by sticking to “server-side” we’re deliberately ignoring another option; building Web APIs in order to serve front-end frameworks like Angular.</em></p><p>In the blue corner we have MVC and in the red, the new kid on the block, Razor Pages.</p><p>In truth they share a lot of the same underlying framework but there are some key differences.</p><p>Before you decide which one to adopt for your next project, it’s worth taking a moment to directly compare them.</p><h3>MVC</h3><p>The old stager, been around since v1 all the way back in 2009.</p><p>Here’s a rough overview of how MVC requests are handled by ASP.NET Core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2ssfphDPTHBNPCtn.png" /></figure><p>The routing engine is key to how ASP.NET Core decides to handle your requests.</p><p>It can be configured to route any request to any controller action.</p><p>The default routing configuration uses a combination of the controller and action names.</p><p>/&lt;controller name&gt;/&lt;action name&gt;</p><p>So a request to /staff/index would route to the action called Index on the StaffController.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/0*HuFt6D4IkFZZouj0.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77540ab3753f739b6b598e36155472a7/href">https://medium.com/media/77540ab3753f739b6b598e36155472a7/href</a></iframe><p>Once the request reaches a controller action, the logic in the action is executed and a response is returned.</p><h3>Where does my code go?</h3><p>In MVC, your application code lives in the controller action.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6b7e473e7c8b2e7f43ad3ef95e850a6/href">https://medium.com/media/c6b7e473e7c8b2e7f43ad3ef95e850a6/href</a></iframe><p>It’s here that you’re going to validate the request, execute any business logic, call your app’s services etc, before eventually returning a response.</p><p>You can use attributes to indicate which kinds of requests your action will accept e.g. GET, POST, PUT (or any of the other HTTP verbs).</p><h3>Where does my presentation code (markup) go?</h3><p>MVC actions don’t have to return a View but they typically do.</p><p>It’s in these views that you’ll put all your HTML markup.</p><p>When a view is returned, MVC needs to locate said view and it achieves this using some default conventions.</p><p>Unless told otherwise, it will look in a Views folder for a folder with the same name as the controller, then a view with the same name as the action.</p><p>e.g. Views\Staff\Index.cshtml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ksw7H8eGm_7lc27_.png" /></figure><p>The key thing to note here is that MVC requests are routed to the controller action and it’s up to the action to determine whether a view is returned (and if so, which view).</p><p>MVC actions can easily override the default conventions and return a specific view (with a name which differs from that of the action).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a6dea2bffd0c4d9ed4eb1b14b4ce7a05/href">https://medium.com/media/a6dea2bffd0c4d9ed4eb1b14b4ce7a05/href</a></iframe><p>This example will cause MVC to go looking for a view called AnotherPage.cshtml in the Views\Staff folder.</p><h3>How do I display data in my views?</h3><p>You can create a ViewModel. This is a class which lives in a .cs file and has properties for the data you wish to show on your view.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4504eda805ecdabbfd3f08d23c2ad26d/href">https://medium.com/media/4504eda805ecdabbfd3f08d23c2ad26d/href</a></iframe><p>Your controller actions can return this data alongside your views.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80b324f045a06c925fc97b015c2933d6/href">https://medium.com/media/80b324f045a06c925fc97b015c2933d6/href</a></iframe><p>Your views can then render this data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9aa8406f1012b4db869c4c473c5a0a2d/href">https://medium.com/media/9aa8406f1012b4db869c4c473c5a0a2d/href</a></iframe><h3>Folder structure</h3><p>Typically, MVC apps have a standard folder-based convention with separate folders for controllers, views and view models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*KNfb0iIqD3zn-ADS.png" /></figure><h3>Razor Pages</h3><p>Razor Pages is brand new in ASP.NET Core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9n8ZL3AhY5RK2cBc.png" /></figure><p>With Razor Pages, when you make a request (e.g. /contact) the default ASP.NET Routing configuration will attempt to locate a Razor Page for that request in the Pages folder.</p><p>It simply looks for a page with the name used in the request (for a request to /contact that would be Contact.cshtml) and routes directly to it.</p><p>The Razor Page then acts as though it were a controller action.</p><p>For a .cshtml file to qualify as a Razor Page, it must live in the Pages folder (using default conventions) and include @page in its markup.</p><h3>Where does my code go?</h3><p>Every Razor Page can have a corresponding Page Model.</p><p>If we stick to the default conventions, ASP.NET will expect that model to have the same name as the corresponding Razor page but with a .cs appended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/0*c-DGXKhmx-uexl8Z.png" /></figure><p>With Razor Pages your application code lives in these models, specifically in methods for the different HTTP verbs (e.g. GET, POST).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0758f60114a52f919c75a19a1e690e6/href">https://medium.com/media/a0758f60114a52f919c75a19a1e690e6/href</a></iframe><h3>Where does my presentation code (markup) go?</h3><p>Well this is simple.</p><p>Because the request was routed directly to the specific razor page that can handle it, there’s no need to go off locating a view, the view is the one the request was routed to e.g. Contact.cshtml.</p><p>The default routing for Razor Pages is simple enough and respects subfolders, so \Pages\Staff\Profile.cshtml would be accessible via a request to /staff/profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*UnepGizCnQ6ON93E.png" /></figure><p>Worth noting that you can omit Index as it is the default page. In this example both /staff/ and /staff/index would take you to Pages\Staff\Index.cshtml.</p><h3>How do I display data in my views?</h3><p>Rather than have separate ViewModels you just need to add properties to your Page Model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97adb33294df1750099c255b2b82bfa0/href">https://medium.com/media/97adb33294df1750099c255b2b82bfa0/href</a></iframe><p>You can directly set those properties from your Page Model methods (e.g. OnGet).</p><p>Then it’s simple to render this data in the Page itself.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/260835fbd43e1bdff2407ee239e78930/href">https://medium.com/media/260835fbd43e1bdff2407ee239e78930/href</a></iframe><h3>Folder structure</h3><p>Everything lives in the Pages folder (by default).</p><p>Each Razor Page consists of the View template (.cshtml) and a corresponding .cs file which effectively acts as a controller action, specifically for that view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/0*L-3ewAlwsR2GEUoy.png" /></figure><h3>In conclusion</h3><p>So there you have it.</p><p>A quick comparison of MVC and Razor Pages.</p><p>Interestingly Microsoft is now advocating that Razor Pages is the preferred choice when building server-side applications using ASP.NET Core.</p><p>A caveat being that it’s early days for Razor Pages and they will almost certainly improve over the next few releases.</p><p>That said, they seem to be off to a promising start and (as this comparison has shown) have the benefit of containing everything relating to a specific request in one place in your application (rather than spreading the pieces around your application like a puzzle which you then have to put back together).</p><p><em>Originally published at </em><a href="https://jonhilton.net/razor-pages-or-mvc-a-quick-comparison/"><em>jonhilton.net</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9131ed5691a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fast track your Angular 2 and .NET Core web app development]]></title>
            <link>https://medium.com/@jon_16396/fast-track-your-angular-2-and-net-core-web-app-development-95adc1a4da0b?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/95adc1a4da0b</guid>
            <category><![CDATA[aspnet]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angular2]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Thu, 01 Dec 2016 12:59:52 GMT</pubDate>
            <atom:updated>2017-02-21T21:11:41.480Z</atom:updated>
            <content:encoded><![CDATA[<p>This is post 1 of 6 in the series <em>“</em><a href="https://jonhilton.net/?post_series=checking-the-weather-with-angular-2-and-asp-net-core"><em>Checking the weather with Angular 2 and ASP.NET Core</em></a><em>”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p9Ypz_hMjX93DhBn." /></figure><blockquote><em>“If you’re an enterprise .NET developer who is used to a mature, integrated, rock-solid toolchain, HTML/CSS/JavaScript development will feel to you like a bag of cats. And the bag is on fire.”’badlife’ (Reddit)</em></blockquote><p>Modern front-end development is a mess of competing frameworks, task runners and build systems that may just have you running back to the safety of ASP.NET and Visual Studio before you’ve even begun.</p><h3>The slow road</h3><p>With Angular 1, you could take your existing ASP.NET web application, add a few script references and get on with adding some SPA goodness to your site.</p><p>Angular 2 changes all that, there is an entire ecosystem that you need to get up and running. You’ll be faced with setting up Grunt/Gulp or WebPack, NodeJS, Typescript and making it all work together before you can even think about writing “Hello World”.</p><p>Ignoring the obvious debate about the merits of this approach and whether all this complexity is really worth it (that’s a conversation for another day) you’re left wondering if there’s any way to test out Angular 2 and build something without learning every nuance of Node, WebPack or anything else deemed necessary by the Angular gods (AKA Google).</p><h3>The highway</h3><p>Before you run screaming back to the (relative) safety of Visual Studio. Here’s another option.</p><p>If you’re using Visual Studio 2015 then you can take a shortcut by using the <strong>ASP.NET Core template pack</strong>. The pack includes a template for creating an Angular 2 with .NET Core project which will have you at “Hello World” in a few clicks.</p><p>That’s not to say you won’t need to learn all about WebPack and Node Modules at some point in the future, but <strong>you don’t need to derail your learning by getting all that set up from day one</strong>.</p><p>Make sure you have the following prerequisites installed.</p><p><a href="https://www.microsoft.com/net/core#windowsvs2015">Visual Studio 2015 Update 3</a> — Update 3 is required.</p><p><a href="https://www.microsoft.com/net/core#windowsvs2015">.NET Core Tooling Preview 2 or later</a> (.NET Core Runtime 1.0.x and 1.1.0 are supported).</p><p><a href="https://www.microsoft.com/en-us/download/details.aspx?id=48593">TypeScript 2</a></p><p><a href="https://nodejs.org/">Node.js version 4 or later</a></p><p>Then grab and install the templates.</p><p><a href="https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ASPNETCoreTemplatePack">Download the ASP.NET Core Template Pack</a>.</p><p>For more detailed background information about the template pack (and a few gotchas you might run into), check out <a href="http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/">Steve Sanderson’s announcement post</a>.</p><h3>Hello World</h3><p>Phew, that’s still a lot of prerequisites and dependencies but now you can sit back, relax, and let the template set up your shiny new web application for you.</p><p>Open up Visual Studio and create a new project.</p><p>You should find some new templates available under “Web”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*0Pda76jfd_NpTHbR." /></figure><p>Choose <strong>ASP.NET Core Angular 2 Starter Application (.NET Core)</strong> and fill out the usual details (name, location etc).</p><p>Once Visual Studio’s finished, you’ll see something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/0*Ke9PFhl5UEvhUfSu." /></figure><p>Before we go into the details, hit CTRL-F5 to preview your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oFCY7lHFhRL48VAZ." /></figure><h3>Made It</h3><p>So you did it, you got to Hello World without having to manually set up WebPack with Angular 2 and Typescript. But what can you do now?</p><p>In <a href="https://jonhilton.net/2016/12/13/angular-2-and-net-core-your-first-component/">the next post we’ll explore the solution and add our first component</a>.</p><p>photo credit: tudedude <a href="http://www.flickr.com/photos/53354512@N00/22414712471">Arduino Controller For Mini Mill Stepper Motor</a> via <a href="http://photopin.com/">photopin</a> <a href="https://creativecommons.org/licenses/by-nc-sa/2.0/">(license)</a></p><p><em>Originally published at </em><a href="https://jonhilton.net/2016/12/01/fast-track-your-angular-2-and-net-core-web-app-development/"><em>jonhilton.net</em></a><em> on December 1, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95adc1a4da0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Not sure what to learn next?]]></title>
            <link>https://medium.com/@jon_16396/not-sure-what-to-learn-next-c72acf566f34?source=rss-2f0dcde6fc49------2</link>
            <guid isPermaLink="false">https://medium.com/p/c72acf566f34</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jon Hilton]]></dc:creator>
            <pubDate>Thu, 24 Nov 2016 12:59:32 GMT</pubDate>
            <atom:updated>2017-01-11T19:09:17.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nxv8VtEaow29JRCW." /></figure><blockquote><em>“I don’t know how to decide which technology to use for my next project”</em></blockquote><blockquote><em>Redditor</em></blockquote><p>Another day, another framework. Should you learn NET or .NET Core, Angular 2 or React, ASP.NET or ASP.NET Core?</p><p>What about those underlying principles? How are your design patterns and SOLID principles?</p><h3>Decisions, decisions</h3><p>One thing you’re not short on is choice but choice has a nasty side effect, it can stop you choosing anything.</p><blockquote><em>“Learning to choose is hard. Learning to choose well is harder. And learning to choose well in a world of unlimited possibilities is harder still, perhaps too hard.”</em></blockquote><blockquote><em>Barry Schwartz, The Paradox of Choice: Why More Is Less</em></blockquote><p>Don’t let this stop you before you’ve even got started.</p><h3>Choose what to learn first</h3><p>It sounds obvious, but if you want to try your hand at something new you need to choose where to start; you need to decide <strong>what to learn first</strong>.</p><p>Without a concrete starting point, you’ll find yourself procrastinating; convincing yourself that there’s too much choice; that you should just give up and watch every episode of Westworld instead.</p><p>Remember, this isn’t a final binding commitment. You aren’t choosing the technology you’re going to work on for the next 5 years, just the technology you want to learn next.</p><h4>Step 1: Brainstorm</h4><p>List every technology/concept you could possibly learn (or would like to).</p><p>Avoid filtering at this point, just get it all written down somewhere.</p><p>Your brain will probably try to stop you putting some things down because they’re “stupid” or far too difficult for you to learn. This is the time to <strong>tell your brain to back off and let you write your list</strong>.</p><h4>Step 2: Identify your filters</h4><p>Now you’ll want to come up with filters to take this big mess of options and whittle it down to one or two.</p><p>What criteria should you use? Well that’s up to you, here are some ideas.</p><ul><li>You can use it in your current job.</li><li>You have some experience in it (or something very similar).</li><li>You have looked and found jobs that you’d like to apply for where they use this.</li><li>There are easily found resources to help you learn it (Pluralsight videos, ebooks, online tutorials etc.)</li><li>It’s fun.</li><li>You want to learn it!</li><li>You know someone else who uses it (who you could ask for help).</li></ul><p>You don’t need to use these but they might help if you can’t think of anything else.</p><p>Come up with your own list of criteria that make sense to you in your current situation.</p><h4>Step 3: Apply your filters</h4><p>From lots of choice to just one or two. Take everything on your list and apply your criteria. If it matches the criteria keep it, otherwise ditch it (remember, you can always come back to it later).</p><p>Hopefully this has narrowed your list down to a few options.</p><p>At this point, you’ll probably have a gut instinct for what you want to learn first but if not remember this; if you don’t have any proof your approach is better than random then just use random!</p><blockquote><em>“When asked about what they regret most in the last six months, people tend to identify actions that didn’t meet expectations. But when asked about what they regret most when they look back on their lives as a whole, people tend to identify failures to act.”</em></blockquote><blockquote><em>Barry Schwartz, The Paradox of Choice: Why More Is Less</em></blockquote><p>Whatever you do, don’t let indecision stop you from taking any action at all. You started down this path because you wanted to choose a new technology/concept to learn. You can always change your mind later and try something else.</p><p>Hopefully you’ve made a decision (feels good right?). You have a technology or concept you want to learn.</p><p>Now comes the fun part. Allocate some regular time, pick a side project to build and get learning.</p><h3>Rinse and Repeat</h3><p>Once you’ve spent a bit of time learning your chosen technology there’s really nothing stopping you from picking up something else.</p><p>You don’t need to become an expert to be able to decide when it makes sense to use a technology/approach for a project (and crucially when it doesn’t), a little experience goes a long way.</p><p><em>photo credit: nicknormal </em><a href="http://www.flickr.com/photos/58347531@N00/26708539713"><em>DON’T PANIC</em></a><em> via </em><a href="http://photopin.com/"><em>photopin</em></a><em> </em><a href="https://creativecommons.org/licenses/by-nc-nd/2.0/"><em>(license)</em></a></p><p><em>Originally published at </em><a href="https://jonhilton.net/2016/11/24/not-sure-what-to-learn-next/"><em>jonhilton.net</em></a><em> on November 24, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c72acf566f34" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>