<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Javascript Archives - Morgan VanYperen</title>
	<atom:link href="/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>/category/javascript/</link>
	<description>this is a blog by Morgan VanYperen</description>
	<lastBuildDate>Sat, 10 Oct 2020 02:09:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.1</generator>
	<item>
		<title>Node Arguments</title>
		<link>/node-arguments/</link>
		
		<dc:creator><![CDATA[morgvanny]]></dc:creator>
		<pubDate>Tue, 19 Dec 2017 07:42:29 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://morgvanny.com/?p=139</guid>

					<description><![CDATA[<p>Something new I learned this week was about how arguments are passed into Node programs from the command line. This was a principle I learned a lot about in a coding challenge I...</p>
<p>The post <a href="/node-arguments/">Node Arguments</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Something new I learned this week was about how arguments are passed into Node programs from the command line. This was a principle I learned a lot about in a coding challenge I did a while back, but in several other languages. Being more familiar with JavaScript, and having already learned how to do it in a few different (but similar) ways, I was able to pick it up pretty easily.</p>
<p>All you need, in order to use command line arguments in Node, is process.argv. That is an array, and it&#8217;s really important to remember that the first 2 elements will have nothing to do with your elements! They actually can differ/depend on your machine, and where the file is located on your hard drive. They can be useful in certain contexts, but when we talk about CLI arguments, we are talking about every element that comes after those 2. Often, you can call process.argv.shift() twice, to get rid of those, and you&#8217;re left with just an array of elements in process.argv. Then you can do as you please with those arguments within the program!</p>
<p>This sort of thing is very helpful because it allows you to dynamically give values to the program without having to save them into any files anywhere. You simply state the values when you execute the program. If you have a long list of arguments you want to supply, it of course makes sense to include those in a file or database, which is then supplied as an argument, or hard-coded for the program to reference specifically &#8211; but that&#8217;s a discussion for another day! I&#8217;m still in early stages of learning node, and I am ultimately focused on using it in the context of web server functionality. This is just a neat thing I learned, that may come in handy sometime!</p>
<p>The post <a href="/node-arguments/">Node Arguments</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">139</post-id>	</item>
		<item>
		<title>React Just Got Better (Again)</title>
		<link>/react-just-got-better/</link>
		
		<dc:creator><![CDATA[morgvanny]]></dc:creator>
		<pubDate>Tue, 05 Dec 2017 01:44:40 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[React]]></category>
		<guid isPermaLink="false">https://morgvanny.com/?p=127</guid>

					<description><![CDATA[<p>Last week I wrote about my favorite change that came with React version 16 &#8211; fragment support in components. I had mentioned that there were still annoying things about it, which required workarounds,...</p>
<p>The post <a href="/react-just-got-better/">React Just Got Better (Again)</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Last week I wrote about my favorite change that came with React version 16 &#8211; fragment support in components. I had mentioned that there were still annoying things about it, which required workarounds, or ignoring warnings. As if on queue, they put out an update the next day that fixed that! Clearly they read my blog, and care about my priorities. Thanks guys.</p>
<p>They explain the change very well <a href="https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html">here</a>. Basically, instead of putting everything into brackets as an array with commas between elements, you can now just wrap it all in what appears to be an html tag, indicating it&#8217;s a fragment. Basically, syntax is almost exactly like it was before fragments existed, but it&#8217;s not an extra div, or whatever you chose to use in the past. They have a few ways to indicate it&#8217;s a fragment, but my favorite is simply &lt;&gt; putting things within blank tags, like this &lt;/&gt;.</p>
<p>This is really interesting to me, because while I haven&#8217;t looked into how exactly they made this work, I&#8217;m pretty sure it works about the same way as when they supported arrays &#8211; they just abstracted away a lot of the code you need to write to indicate how the fragment should be put together. In any case, I like it a lot. While it&#8217;s not anything groundbreaking, it just feels right. It&#8217;s the way things should work. So to you React devs at Facebook who definitely read my blog (lol), I am proud of you. Thanks for all you do!</p>
<p>The post <a href="/react-just-got-better/">React Just Got Better (Again)</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">127</post-id>	</item>
		<item>
		<title>My Favorite React 16 Change</title>
		<link>/favorite-react-16-change/</link>
		
		<dc:creator><![CDATA[morgvanny]]></dc:creator>
		<pubDate>Tue, 28 Nov 2017 06:24:07 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://morgvanny.com/?p=125</guid>

					<description><![CDATA[<p>React 16.0 came out back in September. Old news, right? But when it came out so long, long ago, they made a really nice change, in my opinion. You can return an array...</p>
<p>The post <a href="/favorite-react-16-change/">My Favorite React 16 Change</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>React 16.0 came out back in September. Old news, right? But when it came out so long, long ago, they made a really nice change, in my opinion. You can return an array of elements from a component&#8217;s render method!</p>



<p>One thing that bugged me a bit when learning React, was that when you&#8217;re writing JSX, you can&#8217;t simply return a set of elements. For example, when writing html, the following sort of structure might be typical to see within the body of a document:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"></div>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">&lt;h1&gt;Title&lt;/h1&gt;
&lt;h4&gt;Subtitle&lt;/h4&gt;
&lt;p&gt;Some text&lt;/p&gt;
&lt;p&gt;More text&lt;/p&gt;
&lt;img src="image.jpeg" alt="image description" /&gt;
&lt;p&gt;Even more text&lt;/p&gt;</pre></div>



<p>So when you&#8217;re writing a component, and want it to spit that out, it seems intuitive to just create those tags, and write it as shown above. But you weren&#8217;t allowed to do that! You had to wrap it all into a div, or span, or some kind of package. That&#8217;s very trivial to do, but at the same time, it&#8217;s annoying! I don&#8217;t necessarily want to enclose a bunch of stuff into otherwise unnecessary tags. It makes things more messy than they should be in the end, and there&#8217;s often no good reason for elements to be wrapped like that.</p>



<p>Thankfully, we can now return fragments! Simply wrap the JSX in brackets, and return an array of elements. So instead of throwing it all into a div, which seems more like a workaround to force it to all be technically one element, you simply add some brackets, and place commas between the arrays, indicating that you want to return each of those elements &#8211; the actual stuff you want.</p>



<p>The tricky thing right now is, you get a console warning, unless you assign each element a key. This has to do with how React handles arrays, and what it needs in order to identify changes or removals. For fragments in particular, it actually shouldn&#8217;t matter, but the warning will still appear unless keys are added. This isn&#8217;t so convenient, but I still like where it&#8217;s going &#8211; and the react developers said they&#8217;ll add a special fragment syntax to JSX so it doesn&#8217;t require keys. I&#8217;m looking forward to that!</p>
<p>The post <a href="/favorite-react-16-change/">My Favorite React 16 Change</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">125</post-id>	</item>
		<item>
		<title>Contributing to Open Source</title>
		<link>/contributing-open-source/</link>
		
		<dc:creator><![CDATA[morgvanny]]></dc:creator>
		<pubDate>Mon, 16 Oct 2017 23:54:42 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[React]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://morgvanny.com/?p=103</guid>

					<description><![CDATA[<p>I&#8217;ve been spending time lately, improving my skills in order to be able to make meaningful contributions to open source projects. One thing I&#8217;m trying to get better at is having better git...</p>
<p>The post <a href="/contributing-open-source/">Contributing to Open Source</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve been spending time lately, improving my skills in order to be able to make meaningful contributions to open source projects. One thing I&#8217;m trying to get better at is having better git commit messages. I recommend <a href="https://chris.beams.io/posts/git-commit/">this excellent post</a> on writing descriptive, yet brief git commit messages. It really gets into nitty-gritty details on what makes a message good, or how bad ones can be improved.</p>
<p>In addition to trying to generally improve the notes around my code, I also of course have to learn to code better. The project I found, that I&#8217;m working on contributing to, involves combining React and WordPress together in a pretty unique way. I have an understanding of React, and of WordPress, but I&#8217;ve never used WordPress exclusively as an API before, and I&#8217;ve never used Next.js either. Lucky for me, there is a lot of beginner documentation out there for both &#8211; and this project is still in its infancy &#8211; so there are plenty of basic things to add!</p>
<p>To begin my process, I simply cloned the github repository, and followed the readme&#8217;s instructions for installing dependencies and launching the site in a local environment. Then I opened up the project in my text editor of choice (vscode right now) and looked it over. While I haven&#8217;t used Next.js before, everything for the front-end looked pretty familiar and intuitive based on my experience with React. I familiarized myself with the file structure, and where code and/or libraries were being imported and exported. The WordPress folder was of course, very familiar to me from my time working at Bluehost. Nothing new there.</p>
<p>As I saw how routing was working on the front-end, I knew I&#8217;d need to study more about Next.js if I want to help add components to display pages and posts. That seemed the most obvious thing to add at this point, but it was still unclear to me how to build that out. <a href="https://learnnextjs.com/">Here is where</a> I went to learn to how Next.js works, and how I can add to the project. It&#8217;s really nice because it even has a section for creating dynamic pages &#8211; exactly what I want to be able to do when creating a custom react front-end for WordPress. Now that I have a pretty good understanding of how that works, I should be able to get started following that pattern, and document my work properly with git commit messages. The next tricky part is figuring out what urls to use to fetch the data from WordPress, and make sure the links all work properly. More on this to come.</p>
<p>The post <a href="/contributing-open-source/">Contributing to Open Source</a> appeared first on <a href="">Morgan VanYperen</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">103</post-id>	</item>
	</channel>
</rss>
