<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/rss/styles.xsl" type="text/xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Alex.Party</title><description>Welcome to my website!</description><link>https://alex.party/</link><item><title>Fresh Hot CSS: Trig Functions</title><link>https://alex.party/posts/2026-02-05-fresh-hot-css-trig-functions/</link><guid isPermaLink="true">https://alex.party/posts/2026-02-05-fresh-hot-css-trig-functions/</guid><pubDate>Thu, 05 Feb 2026 05:30:25 GMT</pubDate><content:encoded>&lt;p&gt;Today’s topic is Trig Functions. I feel like Trig Functions don’t get a lot of love because nobody seems to know what
you would actually use them for. I don’t get to go over it in the talk very much. Let’s actually show a
demo of where you might want to use something like this.&lt;/p&gt;

&lt;h3&gt;Trig Functions&lt;/h3&gt;
&lt;p&gt;The Trig functions that are now available are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/sin&quot;&gt;&lt;code&gt;sin()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/cos&quot;&gt;&lt;code&gt;cos()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/tan&quot;&gt;&lt;code&gt;tan()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/asin&quot;&gt;&lt;code&gt;asin()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/acos&quot;&gt;&lt;code&gt;acos()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/atan&quot;&gt;&lt;code&gt;atan()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/atan2&quot;&gt;&lt;code&gt;atan2()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you have ever studied Trigonometry, then these do exactly what you think they do. If you didn’t, this is all
extremely helpful for calculating angles and lengths of sides of triangles. Math stuff.&lt;/p&gt;
&lt;p&gt;Let’s talk about where you’d use them.&lt;/p&gt;
&lt;h3&gt;Placing things in a circle&lt;/h3&gt;
&lt;p&gt;This is the classic example that shows off being able to calculate the placement of multiple items based on their angle relative to each other.&lt;/p&gt;

      See the Pen &amp;lt;a href=&quot;https://codepen.io/bramus/pen/YzBEXJy&quot;&amp;gt;
  CSS Wrapped 2023: Trig Functions&amp;lt;/a&amp;gt; by Bramus (&amp;lt;a href=&quot;https://codepen.io/bramus&quot;&amp;gt;@bramus&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.
      
&lt;h3&gt;CLOCKS!!&lt;/h3&gt;
&lt;p&gt;You can now easily make a clock that will have hands that are correct&lt;/p&gt;

      See the Pen &amp;lt;a href=&quot;https://codepen.io/stoumann/pen/wvxOQKo&quot;&amp;gt;
  CSS sin() and cos() Demo 4&amp;lt;/a&amp;gt; by Mads Stoumann (&amp;lt;a href=&quot;https://codepen.io/stoumann&quot;&amp;gt;@stoumann&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.
      
&lt;h3&gt;Browser Support&lt;/h3&gt;
&lt;p&gt;These functions are well supported, and can absolutely be used, today!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;More Resources&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/articles/css-trig-functions&quot;&gt;Web.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Junior Dev Tip: &quot;Scroll Up&quot;</title><link>https://alex.party/posts/2025-10-08-junior-dev-tip-scroll-up/</link><guid isPermaLink="true">https://alex.party/posts/2025-10-08-junior-dev-tip-scroll-up/</guid><pubDate>Wed, 08 Oct 2025 16:28:48 GMT</pubDate><content:encoded>&lt;p&gt;My junior developer just came to me asking for help because their linting setup was broken. I’m writing this very quickly because I want to get all the details down.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Junior Dev: “My linting is broken, can you help?”&lt;br /&gt;
Me: “Sure”&lt;br /&gt;
&lt;em&gt;get on a call with junior dev&lt;br /&gt;
junior dev runs linting command which ends with lots of “command failed” errors as well as a line that says “17 warnings, 2 errors”&lt;/em&gt;&lt;br /&gt;
Junior Dev: “See?”&lt;br /&gt;
Me: “Scroll up.”&lt;br /&gt;
&lt;em&gt;junior dev scrolls up and sees 2 errors that say they forgot an attribute&lt;/em&gt;&lt;br /&gt;
Junior Dev: “Oh.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I’ve had other experiences recently as well where a different junior developer also couldn’t tell me what was wrong with something. The error was right in front of them and they just didn’t scroll to the right place. They would click everywhere except for the thing that would tell them where the error was.  I recognize that as a junior developers, you’re not as familiar with the tools, but the tools do provide you with information most of the time. You genuinely just need to take a few extra seconds and read what it is saying.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: I did ask my junior developer if it was ok to share this story. they said yes.&lt;/em&gt;&lt;/p&gt;</content:encoded></item><item><title>The future of web development is AI. Get on or get left behind.</title><link>https://alex.party/posts/2025-05-05-the-future-of-web-development-is-ai-get-on-or-get-left-behind/</link><guid isPermaLink="true">https://alex.party/posts/2025-05-05-the-future-of-web-development-is-ai-get-on-or-get-left-behind/</guid><pubDate>Mon, 05 May 2025 07:58:24 GMT</pubDate><content:encoded>&lt;p&gt;Editor’s Note: previous titles for this article have been added here for posterity.&lt;/p&gt;
&lt;h1&gt;The future of web development is blockchain. Get on or get left behind.&lt;/h1&gt;
&lt;h1&gt;The future of web development is CSS-inJS. Get on or get left behind.&lt;/h1&gt;
&lt;h1&gt;The future of web development is Progressive Web Apps. Get on or get left behind.&lt;/h1&gt;
&lt;h1&gt;The future of web development is Silverlight. Get on or get left behind&lt;/h1&gt;
&lt;h1&gt;The future of web development is XHTML. Get on or get left behind.&lt;/h1&gt;
&lt;h1&gt;The future of web development is Flash. Get on or get left behind.&lt;/h1&gt;
&lt;h1&gt;The future of web development is ActiveX. Get on or get left behind.&lt;/h1&gt;
&lt;h1&gt;The future of web development is Java applets. Get on or get left behind.&lt;/h1&gt;
&lt;p&gt;If you aren’t using this technology, then you are shooting yourself in the foot. There is no future where this technology is not dominant and relevant. If you are not using this, you will be unemployable. This technology solves every development problem we have had. I can teach you how with my $5000 course.&lt;/p&gt;</content:encoded></item><item><title>Grid First, Flex Third</title><link>https://alex.party/posts/2025-03-23-grid-first-flex-third/</link><guid isPermaLink="true">https://alex.party/posts/2025-03-23-grid-first-flex-third/</guid><pubDate>Sun, 23 Mar 2025 11:55:29 GMT</pubDate><content:encoded>&lt;p&gt;I’ve been mulling this topic for months now, and I’m pretty firmly of the opinion if you are attempting to do some layout in CSS, you should reach for &lt;code&gt;display:grid&lt;/code&gt; first, followed by &lt;code&gt;display:block&lt;/code&gt;, followed by &lt;code&gt;display:flex&lt;/code&gt;.  Grid allows the layout element to be in control of how things get placed, where as flex really relies on the children to define their widths, which most of the time is not how layout should function at all.&lt;/p&gt;
&lt;h3&gt;Grid First&lt;/h3&gt;
&lt;p&gt;I’ve been working in a very flex heavy codebase the last couple of years, and there are multiple instances where I have needed to rework multiple components that have used a combination of nested flexbox, position relative/absolute, and lots of growing, shrinking, and hardcoded sizes. Most of these issues have been resolved by deleting those styles and turning the layout portion into a grid.&lt;/p&gt;
&lt;p&gt;An example of this would be a text input component. Within this text input component, we had a flexbox layout for the input, that would optionally add margins to the input if there was an icon prop for the start or end, the icons would then be positioned absolute to make sure they ended up at the correct end. This got weird when you started to use &lt;code&gt;ltr&lt;/code&gt; vs &lt;code&gt;rtl&lt;/code&gt; languages, and there was a whole lot of javascript logic just to figure out where an icon needed to go, and which margin needed to be applied.&lt;/p&gt;
&lt;p&gt;Now I recognize not everyone has this problem, but honestly, it was solved pretty much instantly with a single grid definition.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;.input-wrapper&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; inline-grid&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;grid-template-areas&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;front-icon input back-icon&quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;grid-template-columns&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; auto 1fr auto&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This definition will let us assign the starting icon to the “front-icon” grid area, the ending icon to the “back-icon” area, and those will only have width if there is content in there. Done.&lt;/p&gt;
&lt;p&gt;I have more examples of patterns like this where flex box just gets in the way more than helps.&lt;/p&gt;
&lt;h3&gt;Block Second&lt;/h3&gt;
&lt;p&gt;So this might be a hot take, but i have a lot of places in my work code base that still have the following style:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;.descriptive-class-name&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; flex&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;flex-flow&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; column nowrap&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;justify-content&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; start&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;align-items&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; start&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Congratulations! You’ve made a bunch of blocks! You have successfully created the least useful css statement. This is pretty much the equivalent of this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;.descriptive-class-name&amp;gt;*&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;block&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now I can hear some of you saying, “But Alex, what if you want to flip it from being a column to a row?” If this were the case, we wouldn’t be having this conversation. But it isn’t. This is extra code for the sake of “being in control”. Stop it.&lt;/p&gt;
&lt;p&gt;A lot of times, you don’t need flex for the thing that you are doing, you need something else. This is one of those cases.&lt;/p&gt;
&lt;h3&gt;Flex Third&lt;/h3&gt;
&lt;p&gt;Sometimes, you do actually need/want flexbox.  Displaying a grid of cards is a great time to use flexbox (Until you need the contents inside the cards to line up, then you probably want grid and subgrid). Quickly centering something, flexbox is a great option (but so is grid, thus negating this point).&lt;/p&gt;
&lt;p&gt;We have better more powerful tools for layout. Reaching for &lt;code&gt;display:flex&lt;/code&gt; because you are more comfortable with it does not make it the best choice. If we only reached for what we were comfortable with we would all be doing layout with table elements still, and no one wants that (looking at you, MS Outlook).&lt;/p&gt;</content:encoded></item><item><title>I Am Adequate, But Sometimes I Don&apos;t Have The Tools</title><link>https://alex.party/posts/2024-09-18-i-am-adequate-but-sometimes-i-dont-have-the-tools/</link><guid isPermaLink="true">https://alex.party/posts/2024-09-18-i-am-adequate-but-sometimes-i-dont-have-the-tools/</guid><pubDate>Wed, 18 Sep 2024 16:35:57 GMT</pubDate><content:encoded>&lt;p&gt;I’ve spent a lot of my life feeling… inadequate. There is an anger that flairs up about it too. A lot of this stems from my ADHD and learning disabilities, and that growing up, I had many teachers give me the classic line:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“You’re so smart, if you only applied yourself a bit more, you’d be a straight A student.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Note: don’t ever say this to a kid with ADHD)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Sometimes though, I really am giving all that I have in that moment. I struggle a lot with writing (y’all know how consistent I am with writing) and doing things quickly.&lt;/p&gt;
&lt;p&gt;I recently heard someone say something along the lines of “You cannot give 100% all the time.” and metaphorically, it’s a bit like driving a car. If you are driving a car with the accelerator floored at all times, you’re gonna have a bad time. It is both socially acceptable and expected that you can and will go a certain speed. you are not making your car run full throttle all the time. It is okay to be adequate.&lt;/p&gt;
&lt;p&gt;Sometimes though, you get in a car and it’s not…. right. It’s not all there. Maybe you have a 2002 Toyota Camry with a bunch of problems. Maybe when you run it at full throttle, you can only get up to 30 miles per hour (48k/h for my metric folk).  Sometimes, you don’t have the right tools.&lt;/p&gt;
&lt;p&gt;Sometimes giving your all is adequate, and that’s okay because you don’t have the tools.&lt;/p&gt;</content:encoded></item><item><title>Recent Container Query Use: Content next to navigation</title><link>https://alex.party/posts/2024-09-16-recent-container-query-use-content-next-to-navigation/</link><guid isPermaLink="true">https://alex.party/posts/2024-09-16-recent-container-query-use-content-next-to-navigation/</guid><pubDate>Mon, 16 Sep 2024 14:33:19 GMT</pubDate><content:encoded>&lt;p&gt;At work we have a standard layout we are using where there is a nav bar on the left hand side of the screen and content on the right hand side of the screen (this gets flipped for RTL languages). The nav bar can be in an expanded or collapsed state.&lt;/p&gt;
&lt;p&gt;Rather than trying to have multiple media queries for the content area to the right based on whether the nav bar is expanded or collapsed, we’re making the right hand side content be a container. Now within that area, pages can style things with container queries based on the inline-size of the content container without having to track the current state of the sidebar.&lt;/p&gt;</content:encoded></item><item><title>My Recent Container Query Use: Pagination</title><link>https://alex.party/posts/2024-05-27-my-recent-container-query-use-pagination/</link><guid isPermaLink="true">https://alex.party/posts/2024-05-27-my-recent-container-query-use-pagination/</guid><pubDate>Mon, 27 May 2024 06:08:44 GMT</pubDate><content:encoded>&lt;p&gt;I recently read the post &lt;a href=&quot;https://frontendmasters.com/blog/weve-got-container-queries-now-but-are-we-actually-using-them/&quot;&gt;We’ve Got Container Queries Now, But Are We Actually Using Them?&lt;/a&gt; over at Frontend Masters Boost, and I realized that it would probably be helpful for me to document real world uses for container queries.&lt;/p&gt;
&lt;p&gt;Today’s example: A Pagination Component.&lt;/p&gt;
&lt;p&gt;We recently rewrote pagination at work, and I decided  this is an excellent use for container queries. The pagination component has 2 modes: “Big” mode and “Little” mode which really only care about how much horizontal space they have. In most applications this can be done with media queries as your pagination is a top level thing, but we have a lot of content that gets paginated inside of modals, which may or may not take up the full screen.&lt;/p&gt;
&lt;p&gt;Our “Big” mode is when you have multiple page links (think like 10+) and you want to have the pattern display each page link. We use a list of links and also need a “previous” and “next” button at the end. The “Little” mode is what you might think of as “mobile mode” where rather than a list of links, we use a form that has a drop down with the page options. This isn’t just for mobile but can also be used for small paginated lists.&lt;/p&gt;
&lt;h2&gt;CSS Example&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;.pagination-container&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;/* create a pagination container based on the inline size*/&lt;/span&gt;
  &lt;span&gt;container&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; pagination / inline-size&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;/* apply some good styling */&lt;/span&gt;
  &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; flex&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;justify-content&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; center&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;align-items&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; center&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;gap&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 1ch&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;font-size&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 1.4rem&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;border&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 2px solid hotpink&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;.page-links&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;/* hide &quot;Big&quot; mode by default */&lt;/span&gt;
  &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; none&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;list-style&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; none&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;gap&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 1ch&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;margin&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 0&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;padding&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 0&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;/* when it is wider than 30ch, display it*/&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;@container&lt;/span&gt; pagination &lt;span&gt;(&lt;/span&gt;&lt;span&gt;min-width&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 30ch&lt;span&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; flex&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;.page-form&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;/* display &quot;Little&quot; mode by default */&lt;/span&gt;
  &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; flex&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;flex-flow&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; row wrap&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;justify-content&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; center&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;align-items&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; center&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;/* Hide it when it reached 30ch wide */&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;@container&lt;/span&gt; pagination &lt;span&gt;(&lt;/span&gt;&lt;span&gt;min-width&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; 30ch&lt;span&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;display&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; none&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Codepen Demo&lt;/h2&gt;

</content:encoded></item><item><title>React 19 Beta: Fine I Guess Web Standards Are Okay</title><link>https://alex.party/posts/2024-04-26-react-19-beta-fine-i-guess-web-standards-are-okay/</link><guid isPermaLink="true">https://alex.party/posts/2024-04-26-react-19-beta-fine-i-guess-web-standards-are-okay/</guid><pubDate>Thu, 25 Apr 2024 21:02:43 GMT</pubDate><content:encoded>&lt;p&gt;This post is gonna be salty, but after years and years of teaching developers to add click handlers to divs, add inputs with no labels, and generally insisting that they know better than you, react has released their &lt;a href=&quot;https://react.dev/blog/2024/04/25/react-19&quot;&gt;version 19 beta&lt;/a&gt; and it includes support for web components and form actions.&lt;/p&gt;
&lt;p&gt;React has had the ability to add support for custom elements for &lt;a href=&quot;https://github.com/facebook/react/issues/11347&quot;&gt;LITERALLY YEARS&lt;/a&gt;, as there has been a separate experimental branch that was kept up to date and ready to be merged, but never was. So 6 YEARS after custom elements are generally available in every modern browser the react team has decided to BLESS us with the ability to use a native browser feature. After years and years of damage to the ecosystem, and now that pretty much every library that wants to make something, makes things react first, they throw an olive branch to say “Alright peasants, we will support your silly little elements.”&lt;/p&gt;
&lt;p&gt;Similarly, after years and years of saying “Bind a value to every input and don’t worry about using forms” SUDDENLY, it’s now going to be best practice to use forms. How many projects will never implement this? How many countless hours have people spent making pointless click handlers and extra event listeners so that they could replicate a form’s functionality, for the react team to say “Ok, yeah, maybe this web standard is a good idea.”&lt;/p&gt;
&lt;p&gt;The damage from React has already been done, and no amount of “Oh look at this thing we can do” will fix it.&lt;/p&gt;</content:encoded></item><item><title>The DevRel went down to Georgia...</title><link>https://alex.party/posts/2024-02-29-the-devrel-went-down-to-georgia/</link><guid isPermaLink="true">https://alex.party/posts/2024-02-29-the-devrel-went-down-to-georgia/</guid><pubDate>Thu, 29 Feb 2024 22:21:21 GMT</pubDate><content:encoded>&lt;p&gt;Inspiration came from &lt;a href=&quot;https://front-end.social/@sturobson/112014882524066324&quot;&gt;Stu Robson&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;The DevRel Went Down to Georgia&lt;/h2&gt;
&lt;p&gt;(to the tune of &lt;a href=&quot;https://www.youtube.com/watch?v=wBjPAqmnvGA&quot;&gt;The Charlie Daniels Band’s “The Devil Went Down to Georgia”&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The DevRel went down to Georgia, they had some code to shill&lt;br /&gt;They were in a bind, cause they were way behind, and the VP wasn’t thrilled&lt;br /&gt;When they came upon this young dev pushing to main and cursing a lot&lt;br /&gt;The DevRel sat right down and said, “Hey let me tell you what,&lt;br /&gt;&lt;br /&gt;“You probably didn’t know it but I’ve pushed main a time or two,&lt;br /&gt;And if you care to have a share, I’ll make a deal with you,&lt;br /&gt;The thing my company makes can solve your primary issue,&lt;br /&gt;I’ll bet a sticker of gold against your role that it’ll make it faster too.”&lt;br /&gt;The dev said “My names Sally and I’ve got stand-up in ten,&lt;br /&gt;But if you wait, I can give an update, and then we can begin”&lt;br /&gt;&lt;br /&gt;Sally commit and push your code and submit a new PR,&lt;br /&gt;Cause the tests won’t fail in CI, and the DevRel has a card&lt;br /&gt;and if you wait, you’ll win this shiny sticker made of gold&lt;br /&gt;and if you leave, the DevRel gets your role&lt;br /&gt;&lt;br /&gt;The DevRel opened up their mac, and said “I’ll start this show”&lt;br /&gt;And fire flew from their finger tips as they began to git clone&lt;br /&gt;And they pulled a branch, and started to talk about their business&lt;br /&gt;Then a band of recruiters joined in, and it sounded something like this&lt;br /&gt;&lt;br /&gt;[insert amazing guitar/banjo/fiddle solo, overlaid with someone discussing some kind of generic developer product with a chorus of recruiter ooh-ing and ahhh-ing, and miscellaneous keyboard sounds]&lt;br /&gt;&lt;br /&gt;Now when the DevRel finished, Sally said, “That’s a pretty good dry run,&lt;br /&gt;But come sit down in the chair right there, and let me show you my problem.”&lt;br /&gt;&lt;br /&gt;Fire up some docker, npm run&lt;br /&gt;Add a little python, rust for fun&lt;br /&gt;C Sharp in the backend, layer in some go&lt;br /&gt;Tie it all together with a bit of “No Code”&lt;br /&gt;&lt;br /&gt;Well, the DevRel bowed their head because they knew they can’t compete&lt;br /&gt;And they laid that golden sticker down as they got up from their seat&lt;br /&gt;Sally said, “DevRel, don’t feel too bad, or lose any morale,&lt;br /&gt;The tool seems cool, I like your pitch, but I need it to support pascal!”&lt;br /&gt;&lt;br /&gt;Fire up some docker, npm run&lt;br /&gt;Add a little python, rust for fun&lt;br /&gt;C Sharp in the backend, layer in some go&lt;br /&gt;Tie it all together with a bit of “No Code”&lt;/p&gt;
&lt;/blockquote&gt;</content:encoded></item><item><title>Why I Find LLMs Frustrating</title><link>https://alex.party/posts/2024-01-28-why-i-find-llms-frustrating/</link><guid isPermaLink="true">https://alex.party/posts/2024-01-28-why-i-find-llms-frustrating/</guid><pubDate>Sun, 28 Jan 2024 21:38:21 GMT</pubDate><content:encoded>&lt;p&gt;LLMs are a great tool if they are used responsibly. However when you blindly copy and paste the results, it will make your life hell.&lt;/p&gt;
&lt;h3&gt;Don’t Trust The AI&lt;/h3&gt;
&lt;p&gt;We’re currently having to rewrite large portions of our code at work because of a pattern introduced by an LLM that was 100% wrong. It’s not some small part of the codebase either. It’s the data layer.  In no way is this code close to being good or correct.&lt;/p&gt;
&lt;p&gt;Now this being said, the code in question is misusing the &lt;code&gt;useFetch&lt;/code&gt; composable in Nuxt 3. I’ll be honest, I find &lt;code&gt;useFetch&lt;/code&gt; to be very backwards in how it works. Essentially, you declare all your dependencies up front, and then it can automatically update based on reactive values. I know why they went this way, but it’s confusing as heck. Add on top of this an automatic caching mechanism you can’t turn off, and you’re gonna have headaches.&lt;/p&gt;
&lt;p&gt;But when I discovered that the bad code generated is from ChatGPT, I was furious. You cannot blindly accept what an LLM spits out. LLMs spit out something that &lt;strong&gt;approximates what a reasonable response would look like.&lt;/strong&gt; It does not, cannot, and will not attempt to fact check itself, and even when you attempt to correct it, your results will only be technically correct on a good day. So when you copy and paste the first code example you are given, and then copy and paste it all over the code base…. The result isn’t great.&lt;/p&gt;
&lt;h3&gt;On The Other Hand…&lt;/h3&gt;
&lt;p&gt;I have dysgraphia. It’s like dyslexia, but for writing words and communicating ideas. It gets in the way at work very often. I’m regularly having to write issues and communicate technical stuff to multiple other people in a way that isn’t just &lt;a href=&quot;https://www.youtube.com/watch?v=RXJKdh1KZ0w&quot;&gt;sci-fi technobabble&lt;/a&gt;.  I fall short of this frequently. My brain goes faster than my fingers can write (on paper, typing, or speaking sometimes) and I will skip 8 steps when I really need to slow down and connect the dots.&lt;/p&gt;
&lt;p&gt;I was talking to my sister (who specializes in education and communication) after a particularly rough patch, and was explaining all of these woes, my sister just looked at me and said,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Alex, you know that’s what ChatGPT is good at…”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;She was right.&lt;/p&gt;
&lt;p&gt;I needed something that can take my weird jargon and break it out into a more usable format. ChatGPT is great at taking text written and rewriting it into another tone or format.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So, I caved.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I made a little ChatGPT prompt that understands what technology we’re using, I told it to NOT give code examples (I do not have time to correct that nonsense), and I told it to format it in markdown as a github issue with steps to do. I can then &lt;em&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/em&gt; the output as needed to correct its mistakes. It gives me the needed framework to make communication with my team more successful.&lt;/p&gt;
&lt;p&gt;It’s been a mixed success. It’s fixed a lot of the pain points we were having. It’s saved me time. It helps me get around the thing my brain cannot do.&lt;/p&gt;
&lt;h3&gt;More Help&lt;/h3&gt;
&lt;p&gt;I’ve also recently started using &lt;a href=&quot;https://brainstory.ai&quot;&gt;brainstory.ai&lt;/a&gt; to help me think through ideas. I’ve used it to help me write some conference abstracts because (once again) my dygraphia won’t let me format things in a way others will understand. It lets me talk and kinda word vomit out all my ideas and then help summarize what I’ve just said.&lt;/p&gt;
&lt;p&gt;Another great tool to have in your pocket.&lt;/p&gt;
&lt;h3&gt;A Tale of Two AIs&lt;/h3&gt;
&lt;p&gt;I cannot say that I fully endorse using LLMs for everyone. You cannot tell ChatGPT to write your essay homework and expect it to be correct. But, maybe it can help you reword that sentence you’re messing with to make it be better. Maybe if you struggle communicating your thoughts, it can help you put them out in a useful way.&lt;/p&gt;
&lt;p&gt;While I’m not always great at communicating, I don’t always need help. Sometimes I can word vomit an entire page long thing about a topic that I have a mild amount of experience with and hopefully help others without any assitance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Like this.&lt;/strong&gt;&lt;/p&gt;</content:encoded></item><item><title>WTFM</title><link>https://alex.party/posts/2024-01-19-wtfm/</link><guid isPermaLink="true">https://alex.party/posts/2024-01-19-wtfm/</guid><pubDate>Fri, 19 Jan 2024 02:46:32 GMT</pubDate><content:encoded>&lt;p&gt;A philosophy that you should always maintain when developing is to Write The Fricken Manual.&lt;/p&gt;
&lt;p&gt;Many times over the years, i’ve heard the advice to “RTFM”. But the documentation wasn’t great. And no one was writing it. This sounds ridiculous, but until recently, the React documentation was spread across blog posts and tweets, and a huge effort was put into making a new documentation site that was up to date. In a way, it has probably been extremely helpful that React has not released a new version in almost 2 years.&lt;/p&gt;
&lt;p&gt;When you write software, you must write the documetation. &lt;strong&gt;Immediately. Post haste. Pronto.&lt;/strong&gt;  When you move on to the next thing, you will forget how what you just made works. Write documentation like future you is an axe murderer with a time machine. Don’t anger future you.&lt;/p&gt;
&lt;p&gt;Am I perfect at this? &lt;strong&gt;Heck no.&lt;/strong&gt; Ask my coworkers.  We’re struggling through getting stuff in my brain out in a usable form right now.&lt;/p&gt;
&lt;p&gt;You have to try to write the docs though.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;WTFM.&lt;/strong&gt;&lt;/p&gt;</content:encoded></item><item><title>Art Direction with :has()</title><link>https://alex.party/posts/2024-01-18-art-direction-with-has/</link><guid isPermaLink="true">https://alex.party/posts/2024-01-18-art-direction-with-has/</guid><pubDate>Thu, 18 Jan 2024 21:07:05 GMT</pubDate><content:encoded>&lt;p&gt;I’m trying out some new art direction here at &lt;a href=&quot;alex.party.&quot;&gt;alex.party.&lt;/a&gt; let’s see if it works….&lt;/p&gt;</content:encoded></item><item><title>The LightBox Nerd Snipe</title><link>https://alex.party/posts/2024-01-07-the-lightbox-nerd-snipe/</link><guid isPermaLink="true">https://alex.party/posts/2024-01-07-the-lightbox-nerd-snipe/</guid><pubDate>Sun, 07 Jan 2024 22:32:34 GMT</pubDate><content:encoded>&lt;p&gt;I’ve been &lt;a href=&quot;https://xkcd.com/356/&quot;&gt;nerd sniped&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A few weeks ago, Raymond Camden posted about &lt;a href=&quot;https://www.raymondcamden.com/2023/12/13/an-image-dialog-web-component&quot;&gt;An Image Dialog Web Component&lt;/a&gt; and I read that article, added some discussion about how you’d style it, then promptly stopped thinking about it… &lt;em&gt;&lt;strong&gt;consciously&lt;/strong&gt;&lt;/em&gt;. I think it’s been floating around in the back of my brain because another colleague recently asked what &lt;a href=&quot;https://lokeshdhakar.com/projects/lightbox2/&quot;&gt;lightbox&lt;/a&gt; scripts people were using with astro and other SSGs. My immediate thought was “Well, that should be a web component…” completely forgetting that Raymond made a post about it nearly a month prior.&lt;/p&gt;
&lt;p&gt;Anyway, I made my own version.&lt;/p&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/GReZMMx&quot;&amp;gt;
  light-box&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;This version is a bit more forgiving than Raymond’s. It looks for any link with an image inside of it. Which makes it easier to use it with a list, or whatever nested structure you want. It also allows for multiple images and then will give you previous and next buttons based on what is there, but will limit itself to the contents of the current light-box.&lt;/p&gt;
&lt;p&gt;Anyway, You’re welcome. Go use this for good.&lt;/p&gt;
&lt;p&gt;Or chaos.&lt;/p&gt;
&lt;p&gt;Have fun.&lt;/p&gt;</content:encoded></item><item><title>Optionally Shared Context in React Components</title><link>https://alex.party/posts/2023-10-02-optionally-shared-context-in-react-components/</link><guid isPermaLink="true">https://alex.party/posts/2023-10-02-optionally-shared-context-in-react-components/</guid><pubDate>Mon, 02 Oct 2023 16:00:11 GMT</pubDate><content:encoded>&lt;p&gt;Right, here’s a weird one. I know what many of you are thinking:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Alex, why the heck are you writing about React?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The answer is, I just solved an issue for someone and they said to write a blog post. So fine, I’m writing a blog post.&lt;/p&gt;
&lt;h3&gt;Shared React Context&lt;/h3&gt;
&lt;p&gt;So my friend had a problem:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I’ve not dealt with this before: I’m helping someone who has a React component that is reused across a codebase. It pulls variables from a Context to be used in a few functions. BUT, if it’s in a different part of the app, those variables should come from a different Context. The component has a prop that tells you which context it should pull from, but you can’t put the useContext hooks in an if statement&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When I see an issue like this my gut instinct is to point out that in vue you can have optionally reactive data and/or throw this type of thing into a computed value and move on with your day. &lt;em&gt;(Edit: I have been informed that the react linter will pitch a fit about this, but&lt;/em&gt;&lt;code&gt;_useContext_&lt;/code&gt; &lt;em&gt;can actually be accessed conditionally)&lt;/em&gt; But I bit my tongue, and made a minimal reproduction with a solution.&lt;/p&gt;
&lt;h3&gt;Shared Context - Normal Brain Version&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; createContext&lt;span&gt;,&lt;/span&gt; useContext &lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; &lt;span&gt;*&lt;/span&gt; &lt;span&gt;as&lt;/span&gt; ReactDOM &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react-dom&apos;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; App1Context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; App2Context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; &lt;span&gt;MyComponent&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; app1 &lt;span&gt;=&lt;/span&gt; &lt;span&gt;useContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;App1Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; app2 &lt;span&gt;=&lt;/span&gt; &lt;span&gt;useContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;App2Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;app1&lt;span&gt;?&lt;/span&gt;app1&lt;span&gt;:&lt;/span&gt;app2&lt;span&gt;}&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; Apps &lt;span&gt;=&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 1!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 2!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;forEach&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Component&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; mount &lt;span&gt;=&lt;/span&gt; document&lt;span&gt;.&lt;/span&gt;&lt;span&gt;createElement&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;div&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  document&lt;span&gt;.&lt;/span&gt;body&lt;span&gt;.&lt;/span&gt;&lt;span&gt;append&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;mount&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  ReactDOM&lt;span&gt;.&lt;/span&gt;&lt;span&gt;createRoot&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;mount&lt;span&gt;)&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;render&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;Component &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://codepen.io/fimion/pen/GRPXWrd&quot;&gt;Here’s a working demo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The way this works is by requesting both context values. If the 1st one exists, we use that. if the second one exists, then we use that instead.&lt;/p&gt;
&lt;p&gt;Bada-bing, Bada-boom, &lt;strong&gt;solved&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;Mostly solved&lt;/h3&gt;
&lt;p&gt;So, someone commented that really only works if you always want it to default to using the first context, but what if you wanted to use the 2nd context first?&lt;/p&gt;
&lt;p&gt;Well, you’d need to be able to allow to specify the context order that we pick from, so let’s make a slightly more complex version.&lt;/p&gt;
&lt;h3&gt;Shared Context - Big Brain Version&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; createContext&lt;span&gt;,&lt;/span&gt; useContext &lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; &lt;span&gt;*&lt;/span&gt; &lt;span&gt;as&lt;/span&gt; ReactDOM &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react-dom&apos;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; App1Context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; App2Context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; &lt;span&gt;MyComponent&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;{&lt;/span&gt; context &lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; chooseContext &lt;span&gt;=&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;app1&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;useContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;App1Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;app2&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;useContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;App2Context&lt;span&gt;)&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;context&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;app1&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;app2&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;

  &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;Array&lt;span&gt;.&lt;/span&gt;&lt;span&gt;isArray&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;for&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;const&lt;/span&gt; app &lt;span&gt;of&lt;/span&gt; context&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;chooseContext&lt;span&gt;[&lt;/span&gt;app&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;chooseContext&lt;span&gt;[&lt;/span&gt;app&lt;span&gt;]&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;

  &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt; context &lt;span&gt;===&lt;/span&gt; &lt;span&gt;&quot;string&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;chooseContext&lt;span&gt;[&lt;/span&gt;context&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;chooseContext&lt;span&gt;[&lt;/span&gt;context&lt;span&gt;]&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;

  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;YOU&lt;/span&gt; &lt;span&gt;PROVIDED&lt;/span&gt; &lt;span&gt;NOTHING&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; Apps &lt;span&gt;=&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 1!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 2!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 4!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;This will not display.&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
        &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;This will not display.&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 5!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
        &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent context&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;app2&quot;&lt;/span&gt; &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;forEach&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Component&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; mount &lt;span&gt;=&lt;/span&gt; document&lt;span&gt;.&lt;/span&gt;&lt;span&gt;createElement&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;div&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  document&lt;span&gt;.&lt;/span&gt;body&lt;span&gt;.&lt;/span&gt;&lt;span&gt;append&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;mount&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  ReactDOM&lt;span&gt;.&lt;/span&gt;&lt;span&gt;createRoot&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;mount&lt;span&gt;)&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;render&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;Component &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://codepen.io/fimion/pen/ZEVMOER&quot;&gt;Working demo here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This version allows you to pass a &lt;code&gt;context&lt;/code&gt; prop that can be an array of strings or just a string, and specify which context order you want, or which context specifically you want.&lt;/p&gt;
&lt;p&gt;People said this looked good.&lt;/p&gt;
&lt;p&gt;Bada-bing, Bada-boom, &lt;strong&gt;done&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I was hungry so I started to go make lunch. My brain however started to do loop-de-loops in my head, because my brain &lt;strong&gt;LOVES&lt;/strong&gt; patterns. Like way too much. But it saw one. it saw something that could be refactored into an easier use case.&lt;/p&gt;
&lt;p&gt;Fine, brain. Let’s go.&lt;/p&gt;
&lt;p&gt;Let’s start with the generic thing we can use to make this better.&lt;/p&gt;
&lt;h3&gt;SharedContext - Galaxy Brain Mode&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;// shared-context.js&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; useContext &lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;export&lt;/span&gt; &lt;span&gt;class&lt;/span&gt; &lt;span&gt;SharedContext&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;/**
   * shhhh, our secret registry
   */&lt;/span&gt;
  &lt;span&gt;static&lt;/span&gt; #registry &lt;span&gt;=&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; &lt;span&gt;Map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;/**
   * register a shared context
   * @param {string} sharedName - the shared name for the context group.
   * @param {ReactContext} Context - the context object from `createContext`;
   * @return {Symbol} - The identifier used to specify the exact context you would like.
   */&lt;/span&gt;
  &lt;span&gt;static&lt;/span&gt; &lt;span&gt;register&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;sharedName&lt;span&gt;,&lt;/span&gt; Context&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;SharedContext&lt;span&gt;.&lt;/span&gt;#registry&lt;span&gt;.&lt;/span&gt;&lt;span&gt;has&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      SharedContext&lt;span&gt;.&lt;/span&gt;#registry&lt;span&gt;.&lt;/span&gt;&lt;span&gt;set&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName&lt;span&gt;,&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; &lt;span&gt;Map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;

    &lt;span&gt;const&lt;/span&gt; ctx &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; identifier &lt;span&gt;=&lt;/span&gt; &lt;span&gt;Symbol&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName &lt;span&gt;+&lt;/span&gt; ctx&lt;span&gt;.&lt;/span&gt;size&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;set&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;identifier&lt;span&gt;,&lt;/span&gt; Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; identifier&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;

  &lt;span&gt;/**
   * Get a shared context map
   * @param {string} sharedName - the shared name for the context group.
   * @returns {Map&amp;lt;Symbol, ReactContext&amp;gt;} returns a map of Idenitier/Context pairs.
   */&lt;/span&gt;
  &lt;span&gt;static&lt;/span&gt; &lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;#registry&lt;span&gt;.&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;

  &lt;span&gt;/**
   * Get the correct context value based on your current component.
   * @param {string} sharedName - the shared name for the context group.
   * @param {*} [fallback] - The fallback value when no context is provided.
   * @param {Symbol|Symbol[]} [context] - The order of lookup for context based on ID symbols.
   * @returns {*} returns either the fallback or the found context.
   */&lt;/span&gt;
  &lt;span&gt;static&lt;/span&gt; &lt;span&gt;use&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;sharedName&lt;span&gt;,&lt;/span&gt; fallback&lt;span&gt;,&lt;/span&gt; context&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; ctxMap &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;sharedName&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;ctxMap&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;throw&lt;/span&gt; &lt;span&gt;Error&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;`&lt;/span&gt;&lt;span&gt;no such SharedContext: &lt;/span&gt;&lt;span&gt;&lt;span&gt;${&lt;/span&gt;sharedName&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;

    &lt;span&gt;const&lt;/span&gt; ctx &lt;span&gt;=&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; &lt;span&gt;Map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

    ctxMap&lt;span&gt;.&lt;/span&gt;&lt;span&gt;forEach&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Context&lt;span&gt;,&lt;/span&gt; identifier&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;set&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;identifier&lt;span&gt;,&lt;/span&gt; &lt;span&gt;useContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

    &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;context&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;...&lt;/span&gt;ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;keys&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;

    &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;Array&lt;span&gt;.&lt;/span&gt;&lt;span&gt;isArray&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;for&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;const&lt;/span&gt; id &lt;span&gt;of&lt;/span&gt; context&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;id&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
          &lt;span&gt;return&lt;/span&gt; ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;id&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
        &lt;span&gt;}&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;

    &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt; context &lt;span&gt;===&lt;/span&gt; &lt;span&gt;&quot;symbol&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;has&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;return&lt;/span&gt; ctx&lt;span&gt;.&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; fallback&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This code gives us a generic way of creating “Shared Context” states that have a default order. You use &lt;code&gt;SharedContext.register&lt;/code&gt; to register a context to a shared namespace, and it will return a unique Identifier Symbol that you can use to specify the context again when you want to use it. Otherwise it’ll use the ones that are registered in the order they are registered. To use the Shared context you call the &lt;code&gt;SharedContext.use&lt;/code&gt; hook, where you give it the shared namespace, and a fallback value as a default. you can also specify the specific context, or order of the context you would like to use.&lt;/p&gt;
&lt;p&gt;The code to use this looks something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; createContext&lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; &lt;span&gt;*&lt;/span&gt; &lt;span&gt;as&lt;/span&gt; ReactDOM &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;react-dom&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;SharedContext&lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./shared-context.js&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; App1Context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; App2Context &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createContext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;// The order is based on the order of registry...&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; App1ContextId &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;register&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;App&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; App1Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; App2ContextId &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;register&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;App&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; App2Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;// So in theory, with a code split code base, only the ones registered would be used...&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; App2ContextIdAlt &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;register&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;Alt&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; App2Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; App1ContextIdAlt &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;register&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;Alt&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; App1Context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; &lt;span&gt;MyComponent&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;{&lt;/span&gt; context &lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; ctx &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;App&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;YOU PROVIDED NOTHING!!&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;ctx&lt;span&gt;}&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; &lt;span&gt;AltComponent&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;{&lt;/span&gt; context &lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; ctx &lt;span&gt;=&lt;/span&gt; SharedContext&lt;span&gt;.&lt;/span&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;Alt&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;YOU PROVIDED NOTHING!!&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; context&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;ctx&lt;span&gt;}&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;h1&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; Apps &lt;span&gt;=&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 1!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 2!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 4!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;This will not display.&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
        &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;This will not display.&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello App 5!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
        &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent context&lt;span&gt;=&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;App2ContextId&lt;span&gt;}&lt;/span&gt; &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;hr &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello Alt 1!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;AltComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello Alt 2!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;AltComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;&amp;lt;&lt;/span&gt;MyComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;This will not display.&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello Alt 4!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
        &lt;span&gt;&amp;lt;&lt;/span&gt;AltComponent &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;Hello Alt 5!&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider value&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;This will not display.&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
        &lt;span&gt;&amp;lt;&lt;/span&gt;AltComponent context&lt;span&gt;=&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;App1ContextIdAlt&lt;span&gt;}&lt;/span&gt; &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;
      &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App2Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
    &lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;App1Context&lt;span&gt;.&lt;/span&gt;Provider&lt;span&gt;&amp;gt;&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Apps&lt;span&gt;.&lt;/span&gt;&lt;span&gt;forEach&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;Component&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; mount &lt;span&gt;=&lt;/span&gt; document&lt;span&gt;.&lt;/span&gt;&lt;span&gt;createElement&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;div&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  document&lt;span&gt;.&lt;/span&gt;body&lt;span&gt;.&lt;/span&gt;&lt;span&gt;append&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;mount&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  ReactDOM&lt;span&gt;.&lt;/span&gt;&lt;span&gt;createRoot&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;mount&lt;span&gt;)&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;render&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;Component &lt;span&gt;/&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://codepen.io/fimion/pen/PoXdGGa&quot;&gt;Working demo here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is probably the most flexible version. In theory we could also allow the fallback to be a function so if you wanted a fresh version of something you could do that, but ultimately, I don’t want to be responsible for that, and lunch is ready.&lt;/p&gt;
&lt;p&gt;After writing a React helper, I feel a strong need to go take a shower. Y’all take care!&lt;/p&gt;</content:encoded></item><item><title>useFetch in Nuxt 3: The Proper Way</title><link>https://alex.party/posts/2023-09-17-usefetch-in-nuxt-3-the-proper-way/</link><guid isPermaLink="true">https://alex.party/posts/2023-09-17-usefetch-in-nuxt-3-the-proper-way/</guid><pubDate>Sun, 17 Sep 2023 14:33:29 GMT</pubDate><content:encoded>&lt;p&gt;I have recently seen at least 2 people make a wrapper around &lt;code&gt;useFetch&lt;/code&gt; in Nuxt 3 incorrectly by trying to call &lt;code&gt;useFetch&lt;/code&gt; as though it were &lt;code&gt;fetch&lt;/code&gt;. While the approach they take will usually work (in general), it will very quickly cause you to have multiple errors and weird side effects.&lt;/p&gt;
&lt;p&gt;Generally, the example i have seen is something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;export&lt;/span&gt; &lt;span&gt;const&lt;/span&gt; &lt;span&gt;useDataThing&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;// grabing some globally available data via pinia, useStorage, vuex, useState, etc&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; dataThing &lt;span&gt;=&lt;/span&gt; &lt;span&gt;useGlobalDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; dataThingId &lt;span&gt;=&lt;/span&gt; &lt;span&gt;useGlobalDataThingId&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;const&lt;/span&gt; isPending &lt;span&gt;=&lt;/span&gt; &lt;span&gt;ref&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;//create our own fetch handler&lt;/span&gt;
  &lt;span&gt;async&lt;/span&gt; &lt;span&gt;function&lt;/span&gt; &lt;span&gt;fetchDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;// calling a composable like it&apos;s just a function&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; data&lt;span&gt;,&lt;/span&gt; pending &lt;span&gt;}&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;await&lt;/span&gt; &lt;span&gt;useFetch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;`&lt;/span&gt;&lt;span&gt;api/dataThing/&lt;/span&gt;&lt;span&gt;&lt;span&gt;${&lt;/span&gt;dataThingId&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;pending&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    isPending&lt;span&gt;.&lt;/span&gt;value &lt;span&gt;=&lt;/span&gt; pending&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;;&lt;/span&gt;
    dataThing&lt;span&gt;.&lt;/span&gt;value &lt;span&gt;=&lt;/span&gt; data&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;dataThing&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;fetchDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    dataThing&lt;span&gt;,&lt;/span&gt;
    dataThingId&lt;span&gt;,&lt;/span&gt;
    fetchDataThing&lt;span&gt;,&lt;/span&gt;
    isPending&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is a whole bunch of bad errors you’re gonna get from this, mostly stemming from the fact that you’re not calling &lt;code&gt;useFetch&lt;/code&gt; in the root of your composable function. So let’s fix that.&lt;/p&gt;
&lt;h3&gt;A Better Way&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;useFetch&lt;/code&gt; is a composable and should be called in essentially the context of the setup method. It provides a way to trigger fetch calls.&lt;/p&gt;
&lt;p&gt;Let’s rewrite this in a better way.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;export&lt;/span&gt; &lt;span&gt;const&lt;/span&gt;  &lt;span&gt;useDataThing&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;async&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;// grabing some globally available data via pinia, useStorage, vuex, useState, etc&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; dataThing &lt;span&gt;=&lt;/span&gt; &lt;span&gt;useGlobalDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; dataThingId &lt;span&gt;=&lt;/span&gt; &lt;span&gt;useGlobalDataThingId&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;const&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; 
         &lt;span&gt;// Our Data result&lt;/span&gt;
         data&lt;span&gt;,&lt;/span&gt;
         &lt;span&gt;// if the call is pending&lt;/span&gt;
         &lt;span&gt;pending&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;isPending&lt;span&gt;,&lt;/span&gt;
         &lt;span&gt;// 2 ways to trigger the fetch call, they both work the same&lt;/span&gt;
         refesh&lt;span&gt;,&lt;/span&gt; execute&lt;span&gt;,&lt;/span&gt;
         &lt;span&gt;// Let&apos;s make all the other stuff available too: status, errors, etc&lt;/span&gt;
         &lt;span&gt;...&lt;/span&gt;theRest
        &lt;span&gt;}&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;await&lt;/span&gt; &lt;span&gt;useFetch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;
    &lt;span&gt;// We can pass a function as the url param so that we can get the current&lt;/span&gt;
    &lt;span&gt;// value of dataThingId when fetch is called.&lt;/span&gt;
    &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;`&lt;/span&gt;&lt;span&gt;api/dataThing/&lt;/span&gt;&lt;span&gt;&lt;span&gt;${&lt;/span&gt;dataThingId&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;// Don&apos;t call fetch immediately. Wait for us to trigger it.&lt;/span&gt;
      &lt;span&gt;immediate&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;false&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
      &lt;span&gt;// Create a key for caching/correct storage&lt;/span&gt;
      &lt;span&gt;key&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;getDataThingById&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

  &lt;span&gt;//create our own fetch handler&lt;/span&gt;
  &lt;span&gt;async&lt;/span&gt; &lt;span&gt;function&lt;/span&gt; &lt;span&gt;fetchDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;...&lt;/span&gt;args&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;await&lt;/span&gt; &lt;span&gt;refresh&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;...&lt;/span&gt;args&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    dataThing&lt;span&gt;.&lt;/span&gt;value &lt;span&gt;=&lt;/span&gt; data&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;if&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;dataThing&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;await&lt;/span&gt; &lt;span&gt;fetchDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    dataThing&lt;span&gt;,&lt;/span&gt;
    dataThingId&lt;span&gt;,&lt;/span&gt;
    fetchDataThing&lt;span&gt;,&lt;/span&gt;
    isPending&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;...&lt;/span&gt;theRest
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Doing it this way will Make it way more consistent for you. You can now fetch a different piece of data by doing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;const&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;dataThing&lt;span&gt;,&lt;/span&gt; dataThingId&lt;span&gt;,&lt;/span&gt; fetchDataThing&lt;span&gt;}&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;await&lt;/span&gt; &lt;span&gt;useDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

dataThingId&lt;span&gt;.&lt;/span&gt;value &lt;span&gt;=&lt;/span&gt; &lt;span&gt;10&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;await&lt;/span&gt; &lt;span&gt;fetchDataThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;datathing&lt;span&gt;.&lt;/span&gt;value&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt; &lt;span&gt;// will have the updated values.&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hopefully this will save others with a lot of pain.&lt;/p&gt;</content:encoded></item><item><title>Classes, Super, and You</title><link>https://alex.party/posts/2023-07-18-classes-super-and-you/</link><guid isPermaLink="true">https://alex.party/posts/2023-07-18-classes-super-and-you/</guid><pubDate>Tue, 18 Jul 2023 13:37:20 GMT</pubDate><content:encoded>&lt;p&gt;Last week &lt;a href=&quot;https://shoptalkshow.com/573/#t=30:21&quot;&gt;Chris and Dave mentioned&lt;/a&gt; that they don’t get why you have to call &lt;code&gt;super&lt;/code&gt; when you’re in a class.&lt;/p&gt;
&lt;h3&gt;Let’s learn you a thing&lt;/h3&gt;
&lt;p&gt;So first let’s just cover what I’m gonna be talking about here. We’re talking about the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super&quot;&gt;&lt;code&gt;super&lt;/code&gt;&lt;/a&gt; keyword that can be used in JS classes. This keyword is most commonly used in the constructor of a class, and Dave asks:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Why doesn’t class auto-imply super?”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The answer is: &lt;strong&gt;Function Signatures.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;I Don’t Autograph My Functions&lt;/h3&gt;
&lt;p&gt;Function signatures tend to be talked about in other languages more, but the general idea is that a function signature is the name of the function, the arguments and their types, and the return type. this creates a unique identifier for the function you have written also known as its signature.&lt;/p&gt;
&lt;p&gt;That definition is probably an over simplification, but in other languages with types, you can &lt;a href=&quot;https://en.wikipedia.org/wiki/Function_overloading&quot;&gt;overload a function/method definition&lt;/a&gt; by redefining it with a different signature, and it can be used multiple ways. Since JavaScript doesn’t have this concept built in (and TypeScript won’t do this either) we tend to not talk about it… Until you need to extend a class.&lt;/p&gt;
&lt;h3&gt;Extending classes&lt;/h3&gt;
&lt;p&gt;When you extend a class, the original class will have a constructor definition. We’ll use this example from &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super#using_super_in_classes&quot;&gt;MDN&lt;/a&gt; as our basis:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;class&lt;/span&gt; &lt;span&gt;Rectangle&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;constructor&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;height&lt;span&gt;,&lt;/span&gt; width&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;height &lt;span&gt;=&lt;/span&gt; height&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;width &lt;span&gt;=&lt;/span&gt; width&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;get&lt;/span&gt; &lt;span&gt;area&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;height &lt;span&gt;*&lt;/span&gt; &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;width&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;set&lt;/span&gt; &lt;span&gt;area&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;value&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;_area &lt;span&gt;=&lt;/span&gt; value&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Our &lt;code&gt;Rectangle&lt;/code&gt; class has a constructor that takes in a width and a height. This makes sense because a rectangle can have a width that is different from its height.&lt;/p&gt;
&lt;p&gt;So what happens when we do this?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;class&lt;/span&gt; &lt;span&gt;Square&lt;/span&gt; &lt;span&gt;extends&lt;/span&gt; &lt;span&gt;Rectangle&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;constructor&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;length&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The JavaScript engine doesn’t know how to “auto-imply” a super call. There is 1 argument. the extended class constructor needs 2.&lt;/p&gt;
&lt;h3&gt;Enter &lt;code&gt;super&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The fix for this is that the developer must be explicit in how the extended class is constructed.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;class&lt;/span&gt; &lt;span&gt;Square&lt;/span&gt; &lt;span&gt;extends&lt;/span&gt; &lt;span&gt;Rectangle&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;constructor&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;length&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;super&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;length&lt;span&gt;,&lt;/span&gt; length&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Rather than trying to add some AI LLM to every JavaScript engine to try and figure out what your auto implied constructor signature is, you as the developer need to say what the call will be.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Dave, Chris, you have to call super because the engine cannot guess what you are trying to do. I hope this helps.&lt;/p&gt;</content:encoded></item><item><title>Better JavaScript Currying Examples</title><link>https://alex.party/posts/2023-03-24-better-javascript-currying-examples/</link><guid isPermaLink="true">https://alex.party/posts/2023-03-24-better-javascript-currying-examples/</guid><pubDate>Fri, 24 Mar 2023 18:36:53 GMT</pubDate><content:encoded>&lt;p&gt;I’ll admit I went on a bit of a rant the other day on this topic because I find the way people are taught about Currying functions is typically with the least useful examples ever. This is in part because of the push for the functional programming paradigm in JavaScript (which until we have &lt;a href=&quot;https://github.com/tc39/proposal-record-tuple&quot;&gt;Records and Tuples&lt;/a&gt; will continue to be laughable, in my opinion) but also because &lt;a href=&quot;https://en.wikipedia.org/wiki/Currying&quot;&gt;a Currying Function is a mathematical concept.&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;What is a Currying Function?&lt;/h2&gt;
&lt;p&gt;It’s a function that returns a function. Period. It’s named after a mathematician (Haskell Curry) but he wasn’t even the first to use this way of doing things.&lt;/p&gt;
&lt;p&gt;The concept is extremely straightforward to explain, but the nuance as to &lt;strong&gt;when&lt;/strong&gt; to use this is a bit more difficult to explain. This isn’t something you will have to write all the time. Which is why the basic example that gets thrown around a bunch is very… not helpful.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;const&lt;/span&gt; &lt;span&gt;addThreeNumbers&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;a&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;b&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;c&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;a&lt;span&gt;+&lt;/span&gt;b&lt;span&gt;+&lt;/span&gt;c&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;addThreeNumbers&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;// 6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If I saw this code show up in a code review, I would not only ask for changes, but I would probably ask to have a call with the developer to make sure they were okay.&lt;/p&gt;
&lt;p&gt;This example shows up because it is the same as mathematical proofs. It’s there for historical reasons, but not practical reasons.&lt;/p&gt;
&lt;h2&gt;When to Make a Currying Function?&lt;/h2&gt;
&lt;p&gt;So “when” is the bigger thing as to why you want to write a currying function. Currying functions are great when you know want to provide a common value across a function call multiple times, but it may not be a static value.&lt;/p&gt;
&lt;p&gt;So let’s make a &lt;strong&gt;practical&lt;/strong&gt; example of a Currying Function. The example that you have likely run into before is the authenticated fetch handler.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;export&lt;/span&gt; &lt;span&gt;const&lt;/span&gt; &lt;span&gt;createAuthFetch&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;token&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;url&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;options &lt;span&gt;=&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    options&lt;span&gt;.&lt;/span&gt;headers &lt;span&gt;=&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;...&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;options&lt;span&gt;.&lt;/span&gt;headers&lt;span&gt;||&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; 
      &lt;span&gt;&apos;Authorization&apos;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&lt;span&gt;`&lt;/span&gt;&lt;span&gt;Bearer &lt;/span&gt;&lt;span&gt;&lt;span&gt;${&lt;/span&gt;token&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span&gt;`&lt;/span&gt;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; &lt;span&gt;fetch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;url&lt;span&gt;,&lt;/span&gt; options&lt;span&gt;)&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you would never use this function like this (even though you could):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;await&lt;/span&gt; &lt;span&gt;createAuthFetch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;token&lt;span&gt;)&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;url&lt;span&gt;)&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The more likely scenario is that you would have another file that would do something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;createAuthFetch&lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./create-auth-fetch.js&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;getToken&lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./auth-provider.js&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; authFetchFactory &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createAuthFetch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;getToken&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;// Now we generate a handler for each endpoint.&lt;/span&gt;
&lt;span&gt;export&lt;/span&gt; &lt;span&gt;const&lt;/span&gt; fetchUsers &lt;span&gt;=&lt;/span&gt; &lt;span&gt;authFetchFactory&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;/api/users&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;span&gt;export&lt;/span&gt; &lt;span&gt;const&lt;/span&gt; fetchReports &lt;span&gt;=&lt;/span&gt; &lt;span&gt;authFetchFactory&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;/api/reports&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now anywhere in our code base that we want to fetch from our authorized api endpoint, we don’t have to pass a token around.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; fetchUsers &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./auth-fetch.js&apos;&lt;/span&gt;

&lt;span&gt;await&lt;/span&gt; &lt;span&gt;fetchUsers&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;method&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&apos;GET&apos;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a real world example.&lt;/p&gt;
&lt;p&gt;Please stop teaching people to add numbers with Currying Functions as your only example. There are so many more useful ways to show this technique!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; as pointed out, a Currying Function only has one argument technically. So I’ve updated the examples so it is a proper Currying Function.&lt;/p&gt;</content:encoded></item><item><title>Please Be More Physically Active</title><link>https://alex.party/posts/2023-06-14-please-be-more-physically-active/</link><guid isPermaLink="true">https://alex.party/posts/2023-06-14-please-be-more-physically-active/</guid><pubDate>Wed, 14 Jun 2023 20:10:06 GMT</pubDate><content:encoded>&lt;p&gt;Alright, I’ll admit I am the least qualified person to talk about this. But as a mediocre white guy in tech on the internet, I’m going to share my experience.&lt;/p&gt;
&lt;h3&gt;A bit of backstory&lt;/h3&gt;
&lt;p&gt;I don’t work out. I should. All of my doctors agree on that point. In fact, all of those doctors would be pleased if I just started walking a little each day. But my brain is bad, and it thinks that taking a walk is the equivalent of summiting Everest. Everytime I consider any form of physical activity, my brain goes “Ew, no.”&lt;/p&gt;
&lt;p&gt;In a previous career, I spent lots of time pushing boxes, climbing ladders, regularly lifting 20lb lighting fixtures over my head, and this type of activity kept my body in pretty okay shape. Was I the most fit? No. But at least i was moving. A lot.&lt;/p&gt;
&lt;p&gt;Moving over into the Web Dev space, I stopped moving. Like, pretty much entirely. This was/is my downfall.&lt;/p&gt;
&lt;p&gt;A year+ ago I went to see a physical therapist (PT) for the first time. My wrist was always in pain, and I figured it wouldn’t hurt to talk to a professional (let’s be honest) my wife told me to go see her PT. We worked through some stuff, the wrist got better, cool. Then, other things started to hurt.&lt;/p&gt;
&lt;h3&gt;Reality sets in&lt;/h3&gt;
&lt;p&gt;The way my PT at the time explained it to me was this: Most people end up in physical therapy because they have over-extended something. They’ve done too much. And in doing so, they’ve hurt themselves.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;However&lt;/strong&gt;&lt;/em&gt;, There is also the other end of the spectrum, where someone does absolutely nothing at all to the point where the body starts falling apart (not literally, I hope). &lt;em&gt;This is where I am, and let me tell you, it sucks.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;Whatcha gonna do?&lt;/h3&gt;
&lt;p&gt;This is where I’m supposed to be inspirational and stuff, right?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Just lift one thing at a time!”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;or maybe:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“No one ever regrets working out!”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Most platitudes don’t work when your brain won’t cooperate. I genuinely have no idea what I’m gonna do, nor do I have any life altering advice I can give. The only thing I can tell you is what I get told by everyone:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Please, just move more.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Don’t let your body fall apart.&lt;/p&gt;</content:encoded></item><item><title>Delete Your Dev Environment Regularly</title><link>https://alex.party/posts/2023-03-23-delete-your-dev-environment-regularly/</link><guid isPermaLink="true">https://alex.party/posts/2023-03-23-delete-your-dev-environment-regularly/</guid><pubDate>Thu, 23 Mar 2023 00:42:04 GMT</pubDate><content:encoded>&lt;p&gt;I have recently had the opportunity to muse about process and how we maintain a system. One of the things in particular that I have been thinking about the most is onboarding new people into your project.&lt;/p&gt;
&lt;p&gt;In my ideal situation, a developer being able to have a local copy of code up and running should only be limited by the speed of their internet connection. The best way to ensure this is the case is to regularly delete your dev environment and clone a fresh copy down. This gives you a great opportunity to ask some questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How long does it take for you to get set up?&lt;/li&gt;
&lt;li&gt;Is the documentation correct and easily accessible?&lt;/li&gt;
&lt;li&gt;Is it clear who can be contacted if there are questions?&lt;/li&gt;
&lt;li&gt;What is the process for contributing?&lt;/li&gt;
&lt;li&gt;How can someone report an issue?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A lot of these questions are typically answered in a README file, and many projects have multiple files to instruct for how to help out. I &lt;strong&gt;highly&lt;/strong&gt; recommend that you go ahead, delete your dev setup today, and document the steps it takes to get it up and running. Future you, and future contributors will thank you. A lot. Seriously.&lt;/p&gt;</content:encoded></item><item><title>Why I like the JSON:API format more than GraphQL</title><link>https://alex.party/posts/2023-02-17-why-i-like-json-api/</link><guid isPermaLink="true">https://alex.party/posts/2023-02-17-why-i-like-json-api/</guid><pubDate>Fri, 17 Feb 2023 21:53:10 GMT</pubDate><content:encoded>&lt;p&gt;Dave Rupert saw me on stream talk about &lt;a href=&quot;https://jsonapi.org&quot;&gt;JSON:API&lt;/a&gt; and suggested I write a blog about it. So here we are with a clickbait title, and lots of opinions.&lt;/p&gt;
&lt;h3&gt;What is JSON:API?&lt;/h3&gt;
&lt;p&gt;Let’s start with this. JSON:API is a specification for how to format the data for your REST API. It has a standard interface, a standard way of handling filtering, sorting, paging, and relationships. It is a fantastic tool when a backend developer says “How would you like your data formatted?” and you can say “Do it like this.” and then you don’t have to argue about it and can just get to work.&lt;/p&gt;
&lt;p&gt;Here’s an example of a response from the JSON:API home page:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;next&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles?page[offset]=2&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;last&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles?page[offset]=10&quot;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;&quot;data&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;articles&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;1&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;attributes&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;title&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;JSON:API paints my bikeshed!&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;relationships&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;author&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
          &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles/1/relationships/author&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
          &lt;span&gt;&quot;related&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles/1/author&quot;&lt;/span&gt;
        &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
        &lt;span&gt;&quot;data&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;people&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;9&quot;&lt;/span&gt; &lt;span&gt;}&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
      &lt;span&gt;&quot;comments&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
          &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles/1/relationships/comments&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
          &lt;span&gt;&quot;related&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles/1/comments&quot;&lt;/span&gt;
        &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
        &lt;span&gt;&quot;data&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;
          &lt;span&gt;{&lt;/span&gt; &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;comments&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;5&quot;&lt;/span&gt; &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
          &lt;span&gt;{&lt;/span&gt; &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;comments&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;12&quot;&lt;/span&gt; &lt;span&gt;}&lt;/span&gt;
        &lt;span&gt;]&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/articles/1&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;&quot;included&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;people&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;9&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;attributes&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;firstName&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;Dan&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
      &lt;span&gt;&quot;lastName&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;Gebhardt&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
      &lt;span&gt;&quot;twitter&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;dgeb&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/people/9&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;comments&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;5&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;attributes&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;body&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;First!&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;relationships&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;author&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;&quot;data&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;people&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;2&quot;&lt;/span&gt; &lt;span&gt;}&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/comments/5&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;comments&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;12&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;attributes&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;body&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;I like XML better&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;relationships&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;author&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;&quot;data&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; &lt;span&gt;&quot;type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;people&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;9&quot;&lt;/span&gt; &lt;span&gt;}&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;&quot;links&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;&quot;self&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&quot;http://example.com/comments/12&quot;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Whoa, that example seems really verbose!&lt;/h3&gt;
&lt;p&gt;Yep. and I’m totally okay with that. each thing in there has a specific purpose, and it makes my heart sing each time I see something formatted this way, because I know how to find everything. Every data object has a type (for all you typescript nerds). Every object or relation has links for how to get more of a thing.&lt;/p&gt;
&lt;h3&gt;But Alex, GraphQL-&lt;/h3&gt;
&lt;p&gt;Nope. GraphQL requires me to dig through a lot of documentation to figure out what objects are available, how they relate, and then how to write a query to get that data. I have to learn an entire query language to fetch data. With JSON:API, I can hit an endpoint and get well formatted and descriptive data immediately. JSON:API also allows for me to query for related objects in my fetch query. not only that, I don’t have to know some arcane weird syntax to update things. It’s a REST API.&lt;/p&gt;
&lt;h3&gt;You’re being unkind to GraphQL&lt;/h3&gt;
&lt;p&gt;Nope. Really not. I’m sure that there are places where GQL can do really well that I can’t think of (maybe if you are using a graph database?) but honestly, Those tend to not be things I work on. If you like using GraphQL, great! I’m not gonna yuck your yum. But I prefer REST APIs. They just make more sense to me.&lt;/p&gt;
&lt;p&gt;You’re welcome Dave.&lt;/p&gt;</content:encoded></item><item><title>Test Post - Please Ignore</title><link>https://alex.party/posts/2023-02-02-test-post-please-ignore/</link><guid isPermaLink="true">https://alex.party/posts/2023-02-02-test-post-please-ignore/</guid><pubDate>Thu, 02 Feb 2023 17:01:50 GMT</pubDate><content:encoded>&lt;p&gt;I’m setting up some automations, and I’m hoping that I’ll be able to let folks know more effectively what it is that I’m writing about and doing lately.&lt;/p&gt;
&lt;p&gt;I’m doing this automation using &lt;a href=&quot;https://ifttt&quot;&gt;IFTTT&lt;/a&gt; and hopefully (if this goes right) it’ll post to twitter, mastodon, and linkedin.&lt;/p&gt;
&lt;p&gt;Sorry linked in folks if y’all came here and were blinded by the sudden flash of colors and Comic Neue. I promise, I do write about many technology related topics usually.&lt;/p&gt;</content:encoded></item><item><title>Website vs. Application vs. Web App</title><link>https://alex.party/posts/2023-01-03-website-vs-application-vs-web-app/</link><guid isPermaLink="true">https://alex.party/posts/2023-01-03-website-vs-application-vs-web-app/</guid><pubDate>Tue, 03 Jan 2023 17:11:11 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://front-end.social/@jensimmons/109621383745874459&quot;&gt;Jen Simmons&lt;/a&gt; recently posted an interesting question about website thinking for 2023, and I waded into the conversation and realized I have strong opinions as a mediocre white guy in tech. So I’m gonna go into my headspace about these topics.&lt;/p&gt;
&lt;h3&gt;Websites, Applications, and Web Apps Are Both All the Same and Separate&lt;/h3&gt;
&lt;p&gt;When we talk about these 3 concepts, you can have a multitude of combinations of how they work together. There is no clear cut separation of these, only many shades or flavor combinations that come out of it. In general you cannot have one without the other in some way shape or form but many times, It’s based on WHO is interacting at any given time that informs the definition.&lt;/p&gt;
&lt;p&gt;That was wordy. Let me explain.&lt;/p&gt;
&lt;h3&gt;What is a “Website”?&lt;/h3&gt;
&lt;p&gt;A website is just html, js, and css. That’s it. From my distinct perspective specifically, a website is used to present information, and you will generally care about speed, SEO, and proper social meta data for sharing and what not. Many times, this is a landing page, Maybe a blog, product listings… etc. That is a website.&lt;/p&gt;
&lt;h3&gt;What is an “Application”?&lt;/h3&gt;
&lt;p&gt;An application is anytime you want to track state across page loads. or maybe even computer systems. A website can be the “face” of an application. An online store can be an application. Generally speaking, if you can update data in some meaningful way, it’s an application. Applications may or may not care about social sharing. Applications may or maynot need you logged in. Heck, a WordPress site is both a “Website” and an “Application” depending on if you are logged in or not. Or what you are trying to do.&lt;/p&gt;
&lt;h3&gt;What is a “Web App”?&lt;/h3&gt;
&lt;p&gt;This is where things get…. real weird. Generally speaking I would say if I open a website and expect the information to stay updated without me refreshing the page, it’s a web app. If you need to figure out how to manage state in the browser without doing a full page reload…. it’s probably a web app.&lt;/p&gt;
&lt;h3&gt;So How is This Weird?&lt;/h3&gt;
&lt;p&gt;Well, You can have all 3 things be true about any given site. A static website marketing page has a little chat bubble that pops-up that allows you to ask questions.&lt;/p&gt;
&lt;p&gt;The marketing site is 100% a website.&lt;/p&gt;
&lt;p&gt;The chat bubble? A web app.&lt;/p&gt;
&lt;p&gt;All of this stuff is sent from an application.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;My general rule of thumb is: Everything is a website. Treat it like a website, until you know it NEEDS to be a web app.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;*Written from a web app&lt;/em&gt;&lt;/p&gt;</content:encoded></item><item><title>Non-Alcoholic Options for Event Organizers</title><link>https://alex.party/posts/2023-01-23-non-alcoholic-options-for-event-organizers/</link><guid isPermaLink="true">https://alex.party/posts/2023-01-23-non-alcoholic-options-for-event-organizers/</guid><pubDate>Mon, 23 Jan 2023 17:42:16 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://notacult.social/@todd@a11y.info/109730522745173132&quot;&gt;Todd Libby recently posted&lt;/a&gt; about the need for conference organizers to support those of us who don’t want to drink. As someone who has been sober for 13+ years now, I agree whole heartedly with this sentiment. Sometimes it is difficult for people who don’t regularly think about this to know how to have actionable ways of changing things though. So, I’m going to give you some tips. You’re welcome.&lt;/p&gt;
&lt;h2&gt;1 - Alcohol is not the focus&lt;/h2&gt;
&lt;p&gt;If your event centers around alcohol, you’ve already failed. I cannot save you if you decide a “KEG STAND AND BEER PONG/FLIP CUP COMPETITION” is an appropriate thing to have at a professional event. In fact, I might suggest you look into getting help. Anytime you make an event that focuses on drinking as the primary activity, you have excluded the following people:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Recovering alcoholics (Hi.)&lt;/li&gt;
&lt;li&gt;People who take medication that doesn’t allow them to drink&lt;/li&gt;
&lt;li&gt;People who don’t drink for religious reasons&lt;/li&gt;
&lt;li&gt;People who are pregnant&lt;/li&gt;
&lt;li&gt;Anyone under the age of 21 (This is more of USA thing, but generally, still a thing.)&lt;/li&gt;
&lt;li&gt;Anyone who doesn’t feel safe being around people drinking&lt;/li&gt;
&lt;li&gt;Anyone who doesn’t feel like drinking that day&lt;/li&gt;
&lt;li&gt;Anyone who just doesn’t drink&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are hell bent on making an event focused on drinking, please go ahead and print up that list and add it to your flyers to declare that you are fine discriminating against those people.&lt;/p&gt;
&lt;h3&gt;What to do instead: Activities&lt;/h3&gt;
&lt;p&gt;Instead of drinking being the activity, make drinking be a thing next to the activity. Here are a list of potential ideas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Team trivia&lt;/li&gt;
&lt;li&gt;Karaoke&lt;/li&gt;
&lt;li&gt;Bowling (Probably not bowling, it excludes people in a different way)&lt;/li&gt;
&lt;li&gt;Board game night&lt;/li&gt;
&lt;li&gt;Chess Competition&lt;/li&gt;
&lt;li&gt;Food Truck Rally&lt;/li&gt;
&lt;li&gt;Dinner&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There can be drinking. That’s fine! Just don’t make it the focus.&lt;/p&gt;
&lt;h2&gt;2 - Provide Non-Alcoholic Options&lt;/h2&gt;
&lt;p&gt;This is the big one. As someone who doesn’t drink it is a bit of a slap in the face when I go to an event and my options are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Water&lt;/li&gt;
&lt;li&gt;Bottled Water&lt;/li&gt;
&lt;li&gt;Unsweetened Ice Tea&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let’s be honest. You’re here probably because you’re wondering why I am complaining. That’s totally enough options! Nope. No it isn’t. This is the equivalent of showing up to a wine tasting to discover you will only be trying out a walmart brand pinot. This is like going to a brewery and only being able to order Natty Light. It’s like going to a whiskey tasting and being offered jack and coke. IT IS OFFENSIVE.&lt;/p&gt;
&lt;h3&gt;What to do instead: Craft Sodas&lt;/h3&gt;
&lt;p&gt;There are so many different craft sodas (some of which you can get from breweries) that will show you put mild effort into giving people options. Here are some of my favorites:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Abita Root Beer&lt;/li&gt;
&lt;li&gt;Red Hare Root Beer&lt;/li&gt;
&lt;li&gt;Red Hare Grapefruit Soda&lt;/li&gt;
&lt;li&gt;Boylan Sodas&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are so many potential options here. A little bit of effort to have one or two of these available make me feel about 900% more welcome.&lt;/p&gt;
&lt;h3&gt;What to do instead: Mocktails&lt;/h3&gt;
&lt;p&gt;So, you have your very-serious-and-fancy bar for your very-professional-not-alcohol-focused event. People are wearing suits and gowns. they look very nice. So you have a “Signature Cocktail”… why not take another 30 seconds and come up with a “Signature Mocktail” as well. Even if you don’t have a Signature drink for your event, if people have martini glasses, gosh dang, I want a fancy glass too. The difference between a place that says “I can make you a mocktail, what flavors are you interested in?” and then they pour me a gingerale with an orange slice in it vs the places that hand me a menu with good descriptions of interesting mocktails is tremendous. I appreciate a place that can make me what I am in the mood for, but sometimes I want something new. or something I can get another of. Plan out your mocktail menu. I’ll help you here with some products that make this process a lot easier:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://fever-tree.com/&quot;&gt;Fevertree Mixers&lt;/a&gt; are a great starting point for any drink. Bold flavors and readily available.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.seedlipdrinks.com/&quot;&gt;Seedlip Drinks&lt;/a&gt; are complex non alcoholic spirits that add depth to any drink. Also have a &lt;a href=&quot;https://www.seedlipdrinks.com/en-us/cocktails/&quot;&gt;large collection of recipes&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://lesirop.com/&quot;&gt;Le Sirop&lt;/a&gt; a great way to add pizzaz to your drink.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is everything you need to make a fantastic mocktail. I have been places that I ordered every mocktail they had because they were all so good. Don’t be afraid to try out these drinks yourself! Know what you are offering to people.&lt;/p&gt;
&lt;h3&gt;What to do instead: Amazing Food&lt;/h3&gt;
&lt;p&gt;This one is harder. If you can’t make the craft sodas or the mocktails work out, give me food. But it needs to be amazing. Not “I ordered pizza hut” or the Presidential Mcdonalds Meal. It needs to be something local. Something unique to the area. something that will leave me talking about it afterwards. I can’t give you specifics on this, dear reader, but you will know it when you have it right.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Y’all, I know It’s tough being an event organizer. I get it. If you’re already taking into account dietary restrictions, go the extra step, and try making things better for everyone.  A little bit of work goes a very long way.&lt;/p&gt;
&lt;h2&gt;Update&lt;/h2&gt;
&lt;p&gt;Just so we are clear, this post isn’t all encompassing. I have a very USA centric perspective, and you should adjust accordingly to your region/audience. Also these suggestions are not exhaustive. There are lots of other options out there. Not all of these suggestions may work for everyone and are purely my own preferences. Know your audience, and know who you want to have as part of your community.&lt;/p&gt;</content:encoded></item><item><title>Moving to Astro and StaticCMS</title><link>https://alex.party/posts/2022-12-18-moving-to-astro-and-staticcms/</link><guid isPermaLink="true">https://alex.party/posts/2022-12-18-moving-to-astro-and-staticcms/</guid><pubDate>Sun, 18 Dec 2022 03:05:23 GMT</pubDate><content:encoded>&lt;p&gt;Hey Y’all,&lt;/p&gt;
&lt;p&gt;So I spent this past thursday feverishly working on moving my blog from Gridsome and Netlify CMS over to &lt;a href=&quot;https://astro.build/&quot;&gt;Astro&lt;/a&gt; and &lt;a href=&quot;https://staticjscms.netlify.app/&quot;&gt;StaticCMS&lt;/a&gt;  and let me tell you what: It has been extremely rewarding.&lt;/p&gt;
&lt;h2&gt;Gridsome and Netlify-CMS are Dead, Long Live Astro and StaticCMS&lt;/h2&gt;
&lt;p&gt;I am not one to try and constantly change out how things work. I try to find a system I like and stick with it (mostly out of laziness). At work lately we’ve been experimenting with some other systems outside of my normal routine, and Astro has been a big hit with both people at work, and many other people I know. I converted my (extremely simple) blog from gridsome over to astro in a couple of hours. It was really impressive.&lt;/p&gt;
&lt;p&gt;Now, there has been a small amount of movement over the last 2 years at the gridsome project, and I hope they will eventually get things working in vue 3, but honestly, I’m tired of waiting. I also gave nuxt v3 a shot, and…. well… rss support was non existent, everything fel like it was in a state of “we will do that eventually” and I also feel like the end result SSG was a lot bigger than i wanted it to be (javascript wise).&lt;/p&gt;
&lt;p&gt;Astro seemed like a good compromise by allowing me to copy over my styles and vue components and vue pages, and what I found was that it is so much better than a compromise. It’s enjoyable. It’s delightful. I was dubious at first about the &lt;code&gt;.astro&lt;/code&gt; components needed to be used as pages and how they have serverside javascript in… frontmatter tags? But when I started using them, it just clicked. It was so easy.&lt;/p&gt;
&lt;p&gt;I also had been using netlify-cms as my backend and apparently the 2 people who had been maintaining it at netlify &lt;a href=&quot;https://github.com/netlify/netlify-cms/discussions/6503&quot;&gt;are no longer working there&lt;/a&gt; which really kinda kills it. There have been a lot of small bugs here and there for a while, and knowing that no one is going to fix them is frustrating.&lt;/p&gt;
&lt;p&gt;However, StaticCMS is a fork that has been made, and HOPEFULLY, it will be maintained for a while. I’m using it currently. It also has some new and different bugs, but I am sure those will get ironed out.&lt;/p&gt;
&lt;h2&gt;Alex.Party Going Forward&lt;/h2&gt;
&lt;p&gt;All of that being said I am super looking forward to being able to add some features more easily to this here ding dang site.&lt;/p&gt;
&lt;p&gt;Y’all be good.&lt;/p&gt;</content:encoded></item><item><title>New Year, New Things?</title><link>https://alex.party/posts/2023-01-01-new-year-new-things/</link><guid isPermaLink="true">https://alex.party/posts/2023-01-01-new-year-new-things/</guid><pubDate>Sun, 01 Jan 2023 20:00:52 GMT</pubDate><content:encoded>&lt;p&gt;I don’t really like to make resolutions for the new year because I am terrible at following through on them. I do think that this year, I need to focus on me a bit more. Work on exercising, work on finding a hobby or two, and not make everything about content creation.&lt;/p&gt;
&lt;h3&gt;Tired&lt;/h3&gt;
&lt;p&gt;I’m so tired. My yearly seasonal depression has severely impacted my ability to function, and I’m planning on reworking my current medication setup.&lt;/p&gt;
&lt;h3&gt;Speaking&lt;/h3&gt;
&lt;p&gt;I like &lt;a href=&quot;https://toddl.dev/&quot;&gt;Todd Libby’s&lt;/a&gt; idea for doing max 1 conference per month. I already have some speaking engagements planned for 2023, but I will probably be creating less new content for these conferences.&lt;/p&gt;
&lt;h3&gt;Streaming&lt;/h3&gt;
&lt;p&gt;I think i’m going to stream once a week. Maybe less. I’ve been very kind of scatter shot about the content I’m making and I don’t know that I will have the energy to curate the things I’m actually going to work on.&lt;/p&gt;
&lt;h3&gt;Outside&lt;/h3&gt;
&lt;p&gt;I need to go outside more. 3 out of 4 doctors agree. The one that doesn’t agree is my dermatologist. So, just make sure I have suscreen.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;It’s not all doom and gloom. The future holds possibility, and I need to get my own stuff in order so I can get back to doing stuff I enjoy. Hope y’all all have a good new year!&lt;/p&gt;</content:encoded></item><item><title>Hellooooo Astro!</title><link>https://alex.party/posts/2022-12-16-hellooooo-astro/</link><guid isPermaLink="true">https://alex.party/posts/2022-12-16-hellooooo-astro/</guid><pubDate>Fri, 16 Dec 2022 05:51:14 GMT</pubDate><content:encoded>&lt;p&gt;Well,  I am testing out this new astro setup, and using the &lt;a href=&quot;https://staticjscms.netlify.app/&quot;&gt;Static JS CMS&lt;/a&gt; to edit my posts. Let’s see how this goes.&lt;/p&gt;
&lt;p&gt;Currently I’m going to test the draft flag? I may need to edit some code to see if that works correctly. LETS FIND OUT!&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/em&gt;&lt;em&gt;:&lt;/em&gt; the draft feature now works…. I might also do something fun with this.&lt;/p&gt;</content:encoded></item><item><title>If You Give a Function a Function...</title><link>https://alex.party/posts/2022-10-27-if-you-give-a-function-a-function/</link><guid isPermaLink="true">https://alex.party/posts/2022-10-27-if-you-give-a-function-a-function/</guid><pubDate>Thu, 27 Oct 2022 16:05:13 GMT</pubDate><content:encoded>&lt;p&gt;S﻿o Cassie Evans tweeted this the other day:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Frameworks obfuscate away &amp;amp; front-end dev spans so many specialities.&lt;br /&gt;&lt;br /&gt;When there&apos;s a &apos;discussion&apos; on here it&apos;s common to see folks say &apos;learn the web platform&apos;.&lt;br /&gt;&lt;br /&gt;Got me thinking. &lt;br /&gt;&lt;br /&gt;What&apos;s the most useful thing you&apos;ve learnt about the web platform for YOUR area of expertise?&lt;/p&gt;— CSS Evils 😈 !important (@cassiecodes) &lt;a href=&quot;https://twitter.com/cassiecodes/status/1585199459826159616?ref_src=twsrc%5Etfw&quot;&gt;October 26, 2022&lt;/a&gt;&lt;/blockquote&gt;
&lt;p&gt;This got me thinking about a thing that it literally took me YEARS to understand (and frankly severely hampered my coding skills during that period.) And when I say years, I don’t mean like 1 or 2 years. I started learning BASIC and HTML/CSS around 2000, and have been on and off developing since then. So by years, i mean about 15+ years.&lt;/p&gt;
&lt;h2&gt;T﻿he thing about functions…&lt;/h2&gt;
&lt;p&gt;S﻿o the thing I never learned is that a function isn’t some magic thing. &lt;strong&gt;Most languages allow you to pass functions around. As arguments. To other functions.&lt;/strong&gt; This may seem obvious to others, but seriously, I did not understand this concept. Because I didn’t understand this, GUI programming was impossible. JavaScript event handling was not understandable. Certain parts of WordPress were incomprehensible.&lt;/p&gt;
&lt;p&gt;I﻿ remember trying to learn to use PyGTK, and never being able to do much with it.&lt;/p&gt;
&lt;p&gt;O﻿ne day though, I think I was reading some JavaScript code at my first professional programming job, and I suddenly realized you could pass a function as an argument. &lt;strong&gt;SO MANY THINGS CLICKED FOR ME.&lt;/strong&gt;  All at once, the ability to use a bunch of libraries that I could not understand before became open to me and it completely revolutionized how i think about things.&lt;/p&gt;
&lt;p&gt;S﻿o, for all you new to development, understand this: &lt;strong&gt;You can pass a function as an argument to another function.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;T﻿hank you.&lt;/p&gt;</content:encoded></item><item><title>Thoughts on testing</title><link>https://alex.party/posts/2022-11-14-thoughts-on-testing/</link><guid isPermaLink="true">https://alex.party/posts/2022-11-14-thoughts-on-testing/</guid><pubDate>Mon, 14 Nov 2022 14:33:12 GMT</pubDate><content:encoded>&lt;p&gt;Chris Coyier had an &lt;a href=&quot;https://chriscoyier.net/2022/11/11/the-difference-between-integration-testing-and-end-to-end-testing/&quot;&gt;interesting post&lt;/a&gt; on integration vs end to end testing. I made a reply that I want to kinda dig into a little bit.&lt;/p&gt;
&lt;h2&gt;The Testing Pyramid is Weird&lt;/h2&gt;
&lt;p&gt;I have always found the Unit, Integration, and End to End testing pyramid to be a bit… clunky? The names describe how much you are testing, which is great, but it doesn’t give much perspective as to what you are actually trying to test.&lt;/p&gt;
&lt;p&gt;I personally think testing should be thought about more as testing that an interface works as intended. An interface, in this case, is anything someone might interact with. I like to break this out into 3 categories: Developer, Consumer, and User interfaces.&lt;/p&gt;
&lt;h2&gt;Developer Interface Tests&lt;/h2&gt;
&lt;p&gt;These tests are mostly Unit tests for the internal code of your code base. Only developers helping make your product will really get direct benefit from these tests. You want to focus on making your developer interface tests check that functions/classes/components all work as expected for a developer who is using them. You should not test HOW the interface gets its result, only that it does get the result you are looking for.&lt;/p&gt;
&lt;h2&gt;Consumer Interface Tests&lt;/h2&gt;
&lt;p&gt;A Consumer is anyone who will be using your product as potentially a developer, or maybe an application, that is outside of the people developing it. A good example of this would be a public REST or GraphQL API that is used by outside developers. (maybe if you are a back-end developer, the consumer is your front-end team!) It can also be someone who is using your published library. This is still in a way a technical interface test. This is where you get more integration tests as well as unit tests depending on the situation. If you say your REST API will return a JSON object, gosh darn, make sure it does!&lt;/p&gt;
&lt;h2&gt;User Interface Tests&lt;/h2&gt;
&lt;p&gt;User tests are often thought of as being only E2E tests, but I disagree. A User test is testing how a user (generally non technical, but sometimes not depending on what you make) will interact with a thing. E2E tests are very helpful here. but also, if you can atomically do unit tests on an interface, do it! same for integration tests. if you click a button and you want to make sure it displays data from an API, maybe you don’t need the full app to check that functionality. that can be an integration test! User tests are a touch more fluid in my mind than most people make them out to be.&lt;/p&gt;
&lt;h2&gt;That’s enough&lt;/h2&gt;
&lt;p&gt;Hopefully this might help you think about how you approach your tests and maybe next time you don’t know how to write a test for a thing, you’ll ask yourself “Who am I writing this test for?”&lt;/p&gt;</content:encoded></item><item><title>Poop.</title><link>https://alex.party/posts/2022-07-13-poop/</link><guid isPermaLink="true">https://alex.party/posts/2022-07-13-poop/</guid><pubDate>Wed, 13 Jul 2022 14:07:48 GMT</pubDate><content:encoded>&lt;p&gt;I think I now have a few people reading this, so I should update it more regularly, so let’s get some life updates in here.&lt;/p&gt;
&lt;h3&gt;Upcoming Speaking Engagements&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://that.us/events/wi/2022/&quot;&gt;THAT Conference&lt;/a&gt; at the end of July.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://magnoliajs.com&quot;&gt;MagnoliaJS&lt;/a&gt; in September.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Plus some other ones might be around the corner too. Stay tuned.&lt;/p&gt;
&lt;h3&gt;Recent Projects/Pens&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://thissiteisempty.com&quot;&gt;This Site is Empty&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://codepen.io/fimion/pen/wvmaBbm&quot;&gt;Theme System for page wide themes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://codepen.io/fimion/pen/vYdoGyw&quot;&gt;&lt;code&gt;defineCustomElement&lt;/code&gt; accordion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;General Updates&lt;/h3&gt;
&lt;p&gt;Streaming is going well. My follower count has stalled slightly, but this also gives me time to get things I need to get the confetti cannon working.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://wearetraina.com&quot;&gt;Work&lt;/a&gt; is extremely rewarding right now. Having just come from a job that put me on a path to burnout, this one is a breath of fresh air, and is an extremely good place to work for.&lt;/p&gt;
&lt;p&gt;I am helping several friends with their wedding websites, and I love seeing how people want content to be set up. A great gift to a newly engaged couple is offering to help them put finishing touches on a WordPress site. They can usually get it 99% of the way there, and I come in and add the last few touches to make it what they want.&lt;/p&gt;
&lt;p&gt;Alright, this is getting a bit long winded, So that will be enough for now.&lt;/p&gt;</content:encoded></item><item><title>Mechanical Keyboards - I get it now</title><link>https://alex.party/posts/2022-06-22-mechanical-keyboards-i-get-it-now/</link><guid isPermaLink="true">https://alex.party/posts/2022-06-22-mechanical-keyboards-i-get-it-now/</guid><pubDate>Wed, 22 Jun 2022 16:03:33 GMT</pubDate><content:encoded>&lt;p&gt;So a couple of months ago I purchased 2 of &lt;a href=&quot;https://drop.com/buy/stack-overflow-the-key-v2-macropad&quot;&gt;“The Key v2”&lt;/a&gt; as an impulse purchase. I got a link to it a couple of minutes before the link went out to everyone, and so I pulled a Phillip J. Fry.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;They arrived yesterday, and so i plugged one in. The joke about these keyboards is that they have 3 buttons: Control, C, and V. Everything a good programmer needs to copy and paste from stack overflow. However, these boards run QMK, which allows the keyboard to be reflashed with updated key mappings.&lt;/p&gt;
&lt;p&gt;While I have multiple mechanical keyboards, none of them are reprogrammable. I had always figured it’d be too much effort to customize a keyboard, and do you really want to keep up with it? Boy howdy was I wrong.&lt;/p&gt;
&lt;p&gt;I get it now.&lt;/p&gt;
&lt;p&gt;I currently have my little 3 button keyboard set up with multiple layers acting as media keys, as well as space for other future functions. Now I am going to be looking more at keyboards where I can permanently remap my caps lock key to function the way I like it to. (If you tap capslock it functions as f24. If you hold it down it becomes the &lt;a href=&quot;https://medium.com/@Brovalex/superpower-the-caps-lock-key-28be84869cb&quot;&gt;“hyper key”&lt;/a&gt;)&lt;/p&gt;</content:encoded></item><item><title>Review - Hot Betty&apos;s Breakfast Bar - Tucker, GA</title><link>https://alex.party/posts/2022-06-17-review-hot-bettys-breakfast-bar-tucker-ga/</link><guid isPermaLink="true">https://alex.party/posts/2022-06-17-review-hot-bettys-breakfast-bar-tucker-ga/</guid><pubDate>Fri, 17 Jun 2022 13:43:48 GMT</pubDate><content:encoded>&lt;p&gt;Yesterday we went to &lt;a href=&quot;https://www.hotbettystucker.com/&quot;&gt;Hot Betty’s Breakfast Bar&lt;/a&gt; for lunch and I figured I’d write down some thoughts.&lt;/p&gt;
&lt;h2&gt;Food&lt;/h2&gt;
&lt;p&gt;The food was alright. I got the Chicken and Waffles and wasn’t blown away, but also it wasn’t terrible. The chicken was well cooked and had a good crispy fried outside, and a tender juicy inside. However, it was… lacking in flavor? Pizzazz? Kick?&lt;/p&gt;
&lt;p&gt;I also had coffee which was from &lt;a href=&quot;https://www.thecornercupcoffee.com/tucker&quot;&gt;The Corner Cup&lt;/a&gt; down the street. Delightful and delicious as always.&lt;/p&gt;
&lt;p&gt;My wife got the classic breakfast and seemed to like it, and let me have her biscuit. Let’s talk about the biscuit. (For those not in the USA, I do not mean a biscuit like you would have with tea, I mean a &lt;a href=&quot;https://www.foodnetwork.com/recipes/alton-brown/southern-biscuits-recipe-2041990&quot;&gt;biscuit&lt;/a&gt;.)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Can one consider it a biscuit if it is cooked more like cornbread? like… in a pan or sheet. this biscuit was square and clearly had been cut from a sheet.&lt;/li&gt;
&lt;li&gt;The biscuit was over-salted. I like salt. I like more salt than my wife when cooking things. So when I say the biscuit was salty, it was very salty.&lt;/li&gt;
&lt;li&gt;Much like with corn bread, I was not sure how to spread a jam, jelly, or butter on this biscuit. Do I cut it in half and sandwich it? Should I just spread it on top? This was exacerbated by the fact it was a little bit crumbly.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Ambiance&lt;/h2&gt;
&lt;p&gt;While it might be a touch loud to go to with my parents, it was perfectly fine for 30-somethings to gather for lunch. The art was very colorful and welcoming, and the seats were comfortable.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;All in all, it wasn’t terrible. If you drink alcohol, there are libations there that will also entice you. We will probably return at some point… but will likely stay away from the biscuits.&lt;/p&gt;</content:encoded></item><item><title>Brain Dump - May 2022</title><link>https://alex.party/posts/2022-05-04-brain-dump-may-2022/</link><guid isPermaLink="true">https://alex.party/posts/2022-05-04-brain-dump-may-2022/</guid><pubDate>Wed, 04 May 2022 13:44:15 GMT</pubDate><content:encoded>&lt;p&gt;I don’t have any brilliant insights to share today, or anything like that, I’m mostly just wanting to kinda put out some information because I feel like I should write more regular updates.&lt;/p&gt;
&lt;p&gt;I’ve recently started using &lt;a href=&quot;https://centered.app&quot;&gt;centered.app&lt;/a&gt; to help me focus, and BOY HOWDY has it helped (please ignore that I am writing this while not using it.) It helped so much so, that I took some time to make some modifications to the default Macos Shortcuts for setting Do Not Disturb mode that centered provides to start my own music playlist and close applications that are regularly distracting me.&lt;/p&gt;
&lt;p&gt;I’ll be speaking in a couple of days at &lt;a href=&quot;https://stirtrek.com&quot;&gt;Stir Trek&lt;/a&gt; about &lt;a href=&quot;https://github.com/fimion/geo-elements&quot;&gt;geo-elements&lt;/a&gt; and how to make custom elements by remaking deprecated HTML elements. I need to rework the conclusion of the talk a bit, but I think it’s good? Hopefully people will get something out of it. I’ll also be presenting this talk at &lt;a href=&quot;https://that.us/events/wi/2022/&quot;&gt;THAT Conference&lt;/a&gt; in July. So y’all all have another chance to see it in person.&lt;/p&gt;
&lt;p&gt;I know at &lt;a href=&quot;https://chriscoyier.net/&quot;&gt;least&lt;/a&gt; &lt;a href=&quot;https://daverupert.com/&quot;&gt;three&lt;/a&gt; &lt;a href=&quot;https://andrewwalpole.com/&quot;&gt;people&lt;/a&gt; who are doing personal site redesigns. My current site is built on gridsome and netlify CMS, and while I’ve been doing &lt;a href=&quot;https://github.com/wearetraina/nuxt-cms-template&quot;&gt;a lot more stuff with netlify cms&lt;/a&gt;, I kinda get worried about gridsome’s future. also frustrated a bit when i try and do things in it. So i may do a rewrite of my site in astro or eleventy/slinkity. We’ll see.&lt;/p&gt;</content:encoded></item><item><title>My first impression of making a Wordpress Gutenberg block</title><link>https://alex.party/posts/2022-02-19-my-first-impression-of-making-a-wordpress-gutenberg-block/</link><guid isPermaLink="true">https://alex.party/posts/2022-02-19-my-first-impression-of-making-a-wordpress-gutenberg-block/</guid><pubDate>Sat, 19 Feb 2022 16:23:44 GMT</pubDate><content:encoded>&lt;p&gt;This  week I had the opportunity to make a Gutenberg block and there are a few things I learned in The process.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;@wordpress/scripts&lt;/code&gt; is your friend&lt;/h2&gt;
&lt;p&gt;I was impressed by the energy and effort put into the build process for blocks. The automatic webpack 5 config, along with all the tooling also provided was very refreshing and gave a really great developer experience. Also, it was refreshing to see a setup that correctly uses preloaded global variables. Any time you import something from an &lt;code&gt;@wordpress/packagename&lt;/code&gt; path, it actually rewrites it as a mapping to the global &lt;code&gt;window.wp&lt;/code&gt; variable.&lt;/p&gt;
&lt;p&gt;Which leads me to my next point.&lt;/p&gt;
&lt;h2&gt;You don’t need &lt;code&gt;@wordpress/scripts&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;All the tools to make a Gutenberg block are available in the admin area already. You can add a new block with no build step and using vanilla JavaScript. You don’t get to use jsx at all, but if you are looking for no build step, you can do that!&lt;/p&gt;
&lt;p&gt;As I dug more into writing blocks I was surprised by how easy it was to just plop a new block in. I was imagining I would need some complex hook in the backend to format things and maybe validate stuff or what have you, but the block system is really just a front end thing. As I get further into this, I would guess that there is a way to do backend validation, and it’ll be interesting to see what that looks like.&lt;/p&gt;
&lt;h2&gt;It works with custom elements&lt;/h2&gt;
&lt;p&gt;I’ve been on a big custom element kick lately, and I was super happy to see that you can use custom elements super easily with Gutenberg. There is some weird things with some of the attributes and stuff, but I think it is something that can be worked around.&lt;/p&gt;
&lt;h2&gt;You can add extra loaders on top&lt;/h2&gt;
&lt;p&gt;Since &lt;code&gt;@wordpress/scripts&lt;/code&gt; has a webpack config, you can add things on top of it. I wish the experience for this was a bit better, but you can’t win everything. There may be a way to add some webpack chaining to make this happen better, I’ll have to do more digging.&lt;/p&gt;
&lt;p&gt;In my case I was able to get vue 3 components to compile into custom elements, and then load in the front end and admin as well.&lt;/p&gt;
&lt;h2&gt;Things I want to do&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Make some helpers for updating values in a block. There is a lot of boilerplate for edit components that could be very easily made into factory functions.&lt;/li&gt;
&lt;li&gt;Understand what the heck &lt;code&gt;block.json&lt;/code&gt; Is actually doing. It seems to control a few things, but I don’t know what exactly. So I need to find more info about it.&lt;/li&gt;
&lt;li&gt;WHY DOES JSX COMPILE TO REACT INSIDE A VUE SFC? I had made a small experiment to try and get everything into a single file, and you can, but it shouldn’t be possible, but it works. I don’t know why. So more research is needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Final thoughts&lt;/h2&gt;
&lt;p&gt;Gutenberg blocks are neat, and you should definitely spend a couple of days looking into them if you work with Wordpress a lot. They can do quite a bit.&lt;/p&gt;</content:encoded></item><item><title>The JavaScript `in` Operator</title><link>https://alex.party/posts/2021-12-31-the-javascript-in-operator/</link><guid isPermaLink="true">https://alex.party/posts/2021-12-31-the-javascript-in-operator/</guid><pubDate>Fri, 31 Dec 2021 13:19:24 GMT</pubDate><content:encoded>&lt;p&gt;I found out that the JavaScript &lt;code&gt;in&lt;/code&gt; operator is more versatile than I thought while on stream a couple of weeks ago, so let’s write a post about it so I can explain it to myself later.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;for&lt;/code&gt; Loops&lt;/h2&gt;
&lt;p&gt;Let’s start with the place you might have seen the &lt;code&gt;in&lt;/code&gt; operator before. There are 3 ways of doing &lt;code&gt;for&lt;/code&gt; loops in JavaScript.&lt;/p&gt;
&lt;h3&gt;Classic &lt;code&gt;for&lt;/code&gt; Loop&lt;/h3&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/VwMXvEd&quot;&amp;gt;
  for loop&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;In this example, we iterate over a list of things, setting the initial value of the index to 0, then incrementing it by one each time we go through the loop, until we reach the length of the array we are on. This gives us a lot of control over how we loop through things, since we control the step size. However, it’s very verbose.&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;for ... of&lt;/code&gt; Loop&lt;/h3&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/zYEWvmw&quot;&amp;gt;
  for ... of&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;Here, we use the &lt;code&gt;of&lt;/code&gt; keyword to get the value of each index available for iterating over. Less flexible, but it gets us straight to the content we probably want.&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;for ... in&lt;/code&gt; Loop&lt;/h3&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/rNGdOZj&quot;&amp;gt;
  for ... in&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;The &lt;code&gt;for ... in&lt;/code&gt; loop is a mixture of the last 2 examples. Rather than getting the value of an index, instead we get the index. This is less flexible than the classic for loop, but it removes some of the boilerplate.&lt;/p&gt;
&lt;h2&gt;Okay, why?&lt;/h2&gt;
&lt;p&gt;In the previous examples we used the &lt;code&gt;in&lt;/code&gt; operator with a &lt;code&gt;for&lt;/code&gt; loop to get the index of an item in a list. But &lt;code&gt;in&lt;/code&gt; can do more. With the &lt;code&gt;in&lt;/code&gt; keyword, you can also check to see if an array has a value at that position.&lt;/p&gt;
&lt;h3&gt;what.&lt;/h3&gt;
&lt;p&gt;Just go with me here, this will get more useful further on.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;const&lt;/span&gt; things &lt;span&gt;=&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;bananas&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;apples&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;spinach&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;eggs&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&quot;milk&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;1&lt;/span&gt; &lt;span&gt;in&lt;/span&gt; things&lt;span&gt;;&lt;/span&gt; &lt;span&gt;// true&lt;/span&gt;
&lt;span&gt;10&lt;/span&gt; &lt;span&gt;in&lt;/span&gt; things&lt;span&gt;;&lt;/span&gt; &lt;span&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So we can now see if an index is defined in an array. Technically though, &lt;code&gt;in&lt;/code&gt; isn’t just for indexes. It’s for properties.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;&apos;toString&apos;&lt;/span&gt; &lt;span&gt;in&lt;/span&gt; things&lt;span&gt;;&lt;/span&gt; &lt;span&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This becomes incredibly handy if you want to see if an object has a certain property as the &lt;code&gt;in&lt;/code&gt; keyword will also use anything the object inherits as well.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;class&lt;/span&gt; &lt;span&gt;Animal&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;constructor&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;isAlive &lt;span&gt;=&lt;/span&gt; &lt;span&gt;true&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;class&lt;/span&gt; &lt;span&gt;Cat&lt;/span&gt; &lt;span&gt;extends&lt;/span&gt; &lt;span&gt;Animal&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;constructor&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;hairLength&lt;span&gt;,&lt;/span&gt; color&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;super&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;hairLength &lt;span&gt;=&lt;/span&gt; hairLength&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;color &lt;span&gt;=&lt;/span&gt; color&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; catCat &lt;span&gt;=&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; &lt;span&gt;Cat&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;medium&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&apos;gray tabby&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;&apos;isAlive&apos;&lt;/span&gt; &lt;span&gt;in&lt;/span&gt; catCat&lt;span&gt;;&lt;/span&gt; &lt;span&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This behavior differs from &lt;code&gt;Object.hasOwnProperty&lt;/code&gt; which doesn’t look at inherited properties.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;Use the &lt;code&gt;in&lt;/code&gt; keyword to check if an object has a property. If you want more information, take a look at the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in&quot;&gt;MDN article&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>Cassidy asked if I had written anything, so here it is</title><link>https://alex.party/posts/2021-10-21-cassidy-asked-if-i-had-written-anything-so-here-it-is/</link><guid isPermaLink="true">https://alex.party/posts/2021-10-21-cassidy-asked-if-i-had-written-anything-so-here-it-is/</guid><pubDate>Wed, 20 Oct 2021 23:40:35 GMT</pubDate><content:encoded>&lt;p&gt;Look, let’s be honest. You aren’t really here for some earth shattering information. You saw a very clickbaity title that I made to troll &lt;a href=&quot;https://cassidoo.co&quot;&gt;Cassidy Williams&lt;/a&gt; and quite honestly, I don’t think she was ACTUALLY expecting this.&lt;/p&gt;
&lt;p&gt;As long as you are here though, I should write up some interesting links that I’ve found over the past few days that caught my attention.&lt;/p&gt;
&lt;h3&gt;&lt;a href=&quot;https://www.smashingmagazine.com/2021/10/building-ssg-11ty-vite-jam-sandwich/&quot;&gt;Building The SSG I’ve Always Wanted: An 11ty, Vite And JAM Sandwich&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Ben Holmes has an amazing write up of his time over the last almost 2 years of his adventures in making his own static site generator setup. It’s a great read, and honestly is so much fun.&lt;/p&gt;
&lt;h3&gt;Netflix Can do Better&lt;/h3&gt;
&lt;p&gt;The story of the week in my news feed is surrounding Netflix and the new Dave Chappelle special. I have even had a very long phone call with a friend about this. Rather than attempt to pontificate, I’ll link to the 2 articles I have read from the people who are living this story:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://rainofterra.com/it-was-never-about-dave-9aee8b765978&quot;&gt;Terra Field - “It Was Never About Dave”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.nytimes.com/2021/10/19/business/media/netflix-dave-chappelle-employee-walkout.html&quot;&gt;NYT - “Netflix workers plan a walkout as the fallout over Dave Chappelle continues.”&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m writing about this specifically because the friend who called me was asking for perspective about it and he knew I might have thoughts. He is a Black man who is older than I and he asked me to watch the special so we could have a discussion about it. I have yet to watch it, but I will so that I can speak with him from an informed place.&lt;/p&gt;
&lt;h3&gt;&lt;a href=&quot;https://daverupert.com/2021/10/alpha-paintlet/&quot;&gt;Alpha Paintlet&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Dave Rupert talks about using houdini to make custom CSS properties with more magic. I love new web technology and the unlimited terrible things you can do with it.&lt;/p&gt;
&lt;p&gt;And that’s all. There, Cassidy. I wrote something. Your move.&lt;/p&gt;</content:encoded></item><item><title>CSS-Trickz: An Experiment with Netlify&apos;s On-Demand Builders</title><link>https://alex.party/posts/2021-05-29-an-experiment-with-netlifys-on-demand-builders/</link><guid isPermaLink="true">https://alex.party/posts/2021-05-29-an-experiment-with-netlifys-on-demand-builders/</guid><pubDate>Mon, 31 May 2021 03:35:35 GMT</pubDate><content:encoded>&lt;p&gt;At the behest of &lt;a href=&quot;https://daverupert.com/&quot;&gt;Dave Rupert&lt;/a&gt; in the &lt;a href=&quot;https://www.patreon.com/shoptalkshow&quot;&gt;Shop Talk Show D-D-D-Discord&lt;/a&gt;, I’m going to talk about my adventures in making an efficient and poorly designed typo-squatting knock-off of &lt;a href=&quot;https://css-tricks.com&quot;&gt;CSS-Tricks.com&lt;/a&gt; called &lt;a href=&quot;https://css-trickz.com&quot;&gt;CSS-Trickz.com&lt;/a&gt;, which turned into an experiment in how to make a cached and auto building site on Netlify, using their new &lt;a href=&quot;https://docs.netlify.com/configure-builds/on-demand-builders/&quot;&gt;On-Demand Builders&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note: I want to make it clear here, &lt;a href=&quot;https://chriscoyier.net/&quot;&gt;Chris Coyier&lt;/a&gt; knows I made this, and was okay with it. However, this is essentially an article about how to create a CSS-Tricks clone by scraping the information from their API. Don’t use this information for evil. &lt;strong&gt;Do not try to monetize your own clone of another person’s content.&lt;/strong&gt; This has been a fun experiment, and should be regarded as such. For that reason, I’ve removed some of the information of how to access the API directly as I don’t feel comfortable telling people how to clone CSS-Tricks.&lt;/p&gt;
&lt;h3&gt;How it Began: The Naïve Approach&lt;/h3&gt;
&lt;p&gt;I was nerd-sniped by someone suggesting a typo. Someone suggested that there should be CSS-Trickz and I bought the domain. That said, I realized that since CSS-Tricks is built on WordPress, I could actually make a bad clone that just points back to CSS-Tricks. I started off with a naïve implementation that I threw up on Netlify using the &lt;a href=&quot;https://developer.wordpress.org/rest-api/using-the-rest-api/global-parameters/#_jsonp&quot;&gt;WordPress API &lt;code&gt;_jsonp&lt;/code&gt; callback method&lt;/a&gt;. (If you need to get data from a remote WordPress site, this will remove most CORS issues)&lt;/p&gt;
&lt;p&gt;It looked something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;section&lt;/span&gt; &lt;span&gt;id&lt;/span&gt;&lt;span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;articles&lt;span&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;section&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;
  &lt;span&gt;startApp&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;articles&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;// add articles to our section#articles&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span&gt;src&lt;/span&gt;&lt;span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;https://css-tricks.com/{path to api for posts}/?_jsonp=startApp&lt;span&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a quick way to implement adding a feed of most recent articles. It’s great! But, well, Chris did have some feedback:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;uhm google says client side rendering is bad mmkay&lt;/p&gt;
&lt;p&gt;—&lt;a href=&quot;https://github.com/fimion/css-trickz/issues/1&quot;&gt; Chris Coyier&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Second Pass: SSR Function!&lt;/h3&gt;
&lt;p&gt;Alright, Chris had a point. Every time a person would visit the site, it relied on the browser to be able to fetch the data and would (potentially) take a second to render the excerpts of the articles. It would be better if the html was just served straight to the browser with the article excerpts and links all in there already. Netlify Functions to the rescue!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;function&lt;/span&gt; &lt;span&gt;getArticles&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;articles&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; result &lt;span&gt;=&lt;/span&gt; &lt;span&gt;&quot;&quot;&lt;/span&gt;
    &lt;span&gt;// add all the articles we get to result&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; result&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;function&lt;/span&gt; &lt;span&gt;createHTMLDoc&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; indexBody &lt;span&gt;=&lt;/span&gt; &lt;span&gt;&lt;span&gt;`&lt;/span&gt;&lt;span&gt;
      &amp;lt;!DOCTYPE html&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;body&amp;gt;
        &amp;lt;section&amp;gt;{{addArticles}}&amp;lt;/section&amp;gt;
        &amp;lt;/body&amp;gt;
      &amp;lt;/html&amp;gt;
    &lt;/span&gt;&lt;span&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; articles &lt;span&gt;=&lt;/span&gt; &lt;span&gt;JSON&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;parse&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;response&lt;span&gt;.&lt;/span&gt;body&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

    &lt;span&gt;return&lt;/span&gt; indexBody&lt;span&gt;.&lt;/span&gt;&lt;span&gt;replace&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;{{addArticles}}&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;getArticles&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;articles&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;


exports&lt;span&gt;.&lt;/span&gt;&lt;span&gt;handler&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;async&lt;/span&gt; &lt;span&gt;function&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;const&lt;/span&gt; requestOpts &lt;span&gt;=&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; &lt;span&gt;URL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;https://css-tricks.com/{path to api for posts}&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;try&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;const&lt;/span&gt; cssTricksResponse &lt;span&gt;=&lt;/span&gt; &lt;span&gt;await&lt;/span&gt; &lt;span&gt;request&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;requestOpts&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
        &lt;span&gt;return&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
          &lt;span&gt;statusCode&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;200&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; 
          &lt;span&gt;headers&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;&quot;content-type&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&apos;text/html&apos;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; 
          &lt;span&gt;body&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;createHTMLDoc&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;cssTricksResponse&lt;span&gt;)&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
        &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt; &lt;span&gt;catch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;e&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;e&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
        &lt;span&gt;return&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; &lt;span&gt;statusCode&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;500&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;body&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;JSON&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;stringify&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;e&lt;span&gt;)&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives us an HTML response, and the articles get embedded into it!&lt;/p&gt;
&lt;p&gt;Excellent! Problem fixed. Well, kind of.&lt;/p&gt;
&lt;p&gt;This actually gives us a new problem that the function runs on MY dime every time someone comes to the site. while there is a free tier of Netlify Functions, I’d rather not become a victim of internet popularity. Fortunately, Netlify has recently release “On Demand Builders” which allows you to  generate server side rendered pages on-demand when first requested and then use a cached value for every subsequent call. This means, I could run this function once and then it would use that version of the output every single time afterwards.&lt;/p&gt;
&lt;h4&gt;Version 3: Let’s Get Caching!&lt;/h4&gt;
&lt;p&gt;Netlify On-Demand builders will cache the value a serverless function returns and then bust the value on the next build.&lt;/p&gt;
&lt;p&gt;“Alex,” I hear you start to say, “Surely this is extremely complicated and will take a lot of code to make this happen!”&lt;/p&gt;
&lt;p&gt;Nope. Make sure you have run in the root of your project &lt;code&gt;npm install @netlify/functions&lt;/code&gt; and then you can add this little bit of code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &lt;span&gt;const&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;builder&lt;span&gt;}&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;require&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@netlify/functions&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;// ... all the code we had before&lt;/span&gt;

 exports&lt;span&gt;.&lt;/span&gt;handler &lt;span&gt;=&lt;/span&gt; &lt;span&gt;builder&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;async&lt;/span&gt; &lt;span&gt;function&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;// ... this is the same as the previous example&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now our function caches every build. I’ve added a github action to trigger a build every 12 hours, which will bust the cache and fetch new results. But that’s it. It’s pretty easy!&lt;/p&gt;</content:encoded></item><item><title>JavaScript Labels and Returning Early</title><link>https://alex.party/posts/2021-04-02-javascript-labels-and-returning-early/</link><guid isPermaLink="true">https://alex.party/posts/2021-04-02-javascript-labels-and-returning-early/</guid><pubDate>Fri, 02 Apr 2021 13:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Every once in a while, you find a feature of JavaScript you never knew about that has always been there. Labels are one of those odd vestigial bits of the language that make you go “But why?”&lt;/p&gt;
&lt;p&gt;I have previously read about and experimented with labels on for loops in JavaScript and after seeing &lt;a href=&quot;https://twitter.com/BrendanEich/status/1376912996748783616&quot;&gt;Brendan Eich tweet about it&lt;/a&gt;, I decided to experiment on if statements as well. I threw together a little &lt;a href=&quot;https://codepen.io/fimion/pen/NWddamo&quot;&gt;demo codepen&lt;/a&gt; and thought about why we don’t use this style of syntax.&lt;/p&gt;
&lt;p&gt;In a way, JavaScript labels are a callback to older languages and the GOTO command. Well, sort of. Traditionally, labels are used with the GOTO command to denote a place in the code to jump to. While you can still do this in C, it has fallen out of favor over the years as it is less readable and generally can be implemented with either a loop or an &lt;code&gt;if&lt;/code&gt; statement.  JavaScript does not have a GOTO command, but we do have labels. And they are rarely used because typically, there is another way to write your code.&lt;/p&gt;
&lt;h3&gt;Label Use Case&lt;/h3&gt;
&lt;p&gt;The ideal use case for a label is typically with a nested loop or conditional.&lt;/p&gt;

  See the Pen &amp;lt;a href=&apos;https://codepen.io/fimion/pen/WNRpaaK&apos;&amp;gt;Using a Label in a nested for loop&amp;lt;/a&amp;gt; by Alex Riviere
  (&amp;lt;a href=&apos;https://codepen.io/fimion&apos;&amp;gt;@fimion&amp;lt;/a&amp;gt;) on &amp;lt;a href=&apos;https://codepen.io&apos;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;In the above example, we can break out of the outer loop early by calling &lt;code&gt;break outer;&lt;/code&gt; and it will immediately stop the outer loop. Brilliant! Similarly, you can do the same thing with &lt;code&gt;if&lt;/code&gt; or &lt;code&gt;switch&lt;/code&gt; statements, and leave those blocks early.&lt;/p&gt;
&lt;p&gt;You can also label just a plain block of code. This is terribly out of fashion and will only work in non strict mode. More importantly, since ES6 modules are strict mode by default, using a label on a code block will cause your code to break. Generally speaking, I don’t recommend doing this.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;// You can do this.&lt;/span&gt;
&lt;span&gt;// But you really shouldn&apos;t.&lt;/span&gt;
&lt;span&gt;label&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;this will run&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;break&lt;/span&gt; label&lt;span&gt;;&lt;/span&gt;
  console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;this will not&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Returning Early&lt;/h3&gt;
&lt;p&gt;I mentioned earlier that the label pattern typically isn’t seen in use because there are other ways of achieving the same functionality. A good example of this is to use functions to have the same outcome. This also allows the resulting code to be more testable and portable.&lt;/p&gt;

  See the Pen &amp;lt;a href=&apos;https://codepen.io/fimion/pen/gOgmQzQ&apos;&amp;gt;Returning early from a nested for loop&amp;lt;/a&amp;gt; by Alex Riviere
  (&amp;lt;a href=&apos;https://codepen.io/fimion&apos;&amp;gt;@fimion&amp;lt;/a&amp;gt;) on &amp;lt;a href=&apos;https://codepen.io&apos;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;In the above code we’ve broken the logic for both loops out into their own functions. The &lt;code&gt;outerLoop&lt;/code&gt; function will call whatever callback we give it and the &lt;code&gt;innerLoop&lt;/code&gt; function receives the value of &lt;code&gt;x&lt;/code&gt; as an argument. We then call &lt;code&gt;outerLoop(innerLoop);&lt;/code&gt; to kick off the whole thing. Both loops can escape early by returning before the loop is completed.&lt;/p&gt;
&lt;p&gt;Code being broken into smaller pieces like this is why you do not see as much use of JavaScript labels. I love labels and the power they have, but I don’t know that I’d want them in my code.&lt;/p&gt;</content:encoded></item><item><title>Vue 2 to Vue 3 - 8 months on</title><link>https://alex.party/posts/2021-04-29-vue-2-to-3-6-months-on/</link><guid isPermaLink="true">https://alex.party/posts/2021-04-29-vue-2-to-3-6-months-on/</guid><pubDate>Wed, 05 May 2021 21:31:45 GMT</pubDate><content:encoded>&lt;p&gt;Vue 3 has been out for almost 8 months now. Adoption is slow. This is feeling a little like another major version bump I’ve lived through. Is Vue the new Python?&lt;/p&gt;
&lt;p&gt;When I started developing this go around, I was getting into Python and I was confused about Python 2 vs Python 3 and what I should be using. This was back in 2015, and the support for Python 3 was very low. Similarly, Vue 3 has been released for 8 months now and it is still considered the &lt;code&gt;@next&lt;/code&gt; version. Articles and talks all point to using Vue 3, but to a new user, everything still points to Vue 2. This creates confusion and bad messaging.&lt;/p&gt;
&lt;p&gt;Recently, &lt;a href=&quot;https://twitter.com/vuejs/status/1388144585600274433&quot;&gt;Vue.js announced that version 3.1 would be a migration build&lt;/a&gt; to help people move from version 2 to version 3. Realistically, the move from version 2 to 3 will take more than just a migration build. The ecosystem has not really caught up, though &lt;a href=&quot;https://twitter.com/Atinux/status/1365324549215186951&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;https://twitter.com/vuetifyjs/status/1387437816813080581&quot;&gt;major&lt;/a&gt; &lt;a href=&quot;https://twitter.com/quasarframework/status/1389523264482029573&quot;&gt;players&lt;/a&gt; are close to having or already have Vue 3 compatible versions.&lt;/p&gt;
&lt;p&gt;As we move closer and closer to a full year of Vue 3 having been released, I worry that we are starting to veer into the quagmire the Python community experienced when they released Python 3. It took them &lt;a href=&quot;https://www.python.org/doc/sunset-python-2/&quot;&gt;14 years to sunset Python 2&lt;/a&gt;, and it is still being used by many operating systems &lt;a href=&quot;https://docs.python.org/3/library/2to3.html&quot;&gt;all the while having a tool that will help you move from Python 2 to 3&lt;/a&gt; (it still couldn’t fix all the issues). When I was learning Python in 2015, Python 2 was still the main version being used primarily and it took another 3 years before Python 3 was the majority version.&lt;/p&gt;
&lt;p&gt;Learning Python, I was constantly confused as to why the example I was trying to use wasn’t working. Either I would be in a Python 2 tutorial and a Python 3 interpreter or visa-versa. The older tutorials wouldn’t mention Python 3 as they were not updated, and the new tutorials were not good about explaining that you needed to make sure you were using the right version.&lt;/p&gt;
&lt;p&gt;I love Vue (much as I still love Python) but we as a community need to recognize that the current messaging needs to not be “NEW COOL SHINY VUE 3” but we need to focus on “Here’s how you can move from 2 to 3”. The Python ecosystem spun their wheels for years because there was not a good path to move up a major version. If we as a community do not focus on helping people move from Vue 2 to Vue 3 now, then we will spend years having to support both.&lt;/p&gt;</content:encoded></item><item><title>My first thoughts on React</title><link>https://alex.party/posts/2020-10-11-my-first-thoughts-on-react/</link><guid isPermaLink="true">https://alex.party/posts/2020-10-11-my-first-thoughts-on-react/</guid><pubDate>Sun, 11 Oct 2020 01:28:14 GMT</pubDate><content:encoded>&lt;p&gt;I’m diving into react, coming from vue, and I have some thoughts.&lt;/p&gt;
&lt;p&gt;I started Kent C. Dodd’s &lt;a href=&quot;https://epicreact.dev&quot;&gt;Epic React&lt;/a&gt; course, and first off, i’ve barely scratched the surface. This course is excellent, and will likely be my go to recommendation if someone wants to learn react.&lt;/p&gt;
&lt;p&gt;While the course is fantastic, I find React… awkward. Some of this is that JSX looks like a syntax error for me. But I’m working on getting over that, and trying to remember it’s just a compiler directive.&lt;/p&gt;
&lt;p&gt;Another thing that I’m struggling with is &lt;code&gt;propTypes&lt;/code&gt;. It’s ugly and feels a bit bolted on. My guess is this is a left over from the Class based syntax that has been moved away from and they haven’t found an elegant way of redoing it. This is likely just me being used to Vue and having a strong bias towards its syntax.&lt;/p&gt;
&lt;p&gt;Overall, I am not very far into this journey, so I can’t talk much about technical implementation, efficiency, or nuances. I recognize this is mostly surface level observations, and I will try to keep up with my thoughts as I dive deeper.&lt;/p&gt;</content:encoded></item><item><title>Vue-Solitaire Migration to Vue 3 - The unexpected challenge</title><link>https://alex.party/posts/2020-10-26-vue-solitaire-migration-to-vue-3-the-unexpected-challenge/</link><guid isPermaLink="true">https://alex.party/posts/2020-10-26-vue-solitaire-migration-to-vue-3-the-unexpected-challenge/</guid><pubDate>Tue, 27 Oct 2020 21:37:09 GMT</pubDate><content:encoded>&lt;p&gt;I upgraded an app to Vue 3 and I learned some things about it.&lt;/p&gt;
&lt;p&gt;I’ve just finished upgrading &lt;a href=&quot;https://vue-solitaire.netlify.app&quot;&gt;vue-solitaire&lt;/a&gt; to use Vue 3. There are 3 main things I learned in this process that I wanted to let you (dear reader) know about.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First, the way you add global components has changed a little.&lt;/li&gt;
&lt;li&gt;Next, the way apps mount has both syntactically changed, as well as how it ends up in the DOM has changed.&lt;/li&gt;
&lt;li&gt;Finally, Vue 3 has a new way of code-splitting and loading components asynchronously but throws a very unhelpful error: &lt;code&gt;Invalid VNode type: undefined&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Vue Solitaire&lt;/h3&gt;
&lt;p&gt;As some background, &lt;a href=&quot;https://github.com/fimion/vue-solitaire&quot;&gt;Vue Solitaire&lt;/a&gt; is my pet project I made to demo a few concepts for others struggling with challenges similar to situations I’ve been in. Most notably it is 5 separate vue apps communicating with each other via a Vuex store. There are 4 areas (Deck, Flop, Play, and Final) that cards can appear. Each of these Areas is an individual Vue app that move cards around in Vuex modules. While this seems silly, it’s a useful example that can be translated into other things. For instance, If we want a “Buy Now!” button that is a vue app and a “Cart Icon” that is also a Vue app, we can make these as separate instances on the page, but use Vuex to maintain the state of the cart that both reference.&lt;/p&gt;
&lt;h3&gt;Adding Global Components&lt;/h3&gt;
&lt;p&gt;In Vue 2, the syntax to add a component globally to Vue, we would write code like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; Vue &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; MyComponent &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./MyComponent.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; App &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./App.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Vue&lt;span&gt;.&lt;/span&gt;&lt;span&gt;component&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;my-component&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; MyComponent&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; myApp &lt;span&gt;=&lt;/span&gt; &lt;span&gt;new&lt;/span&gt; &lt;span&gt;Vue&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;App&lt;span&gt;)&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;$mount&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;#app&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Well, In Vue 3, you no longer bind things to the global &lt;code&gt;Vue&lt;/code&gt; object. Instead, we need to apply it to our Vue app instance. This will feel very familiar however.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; createApp &lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; MyComponent &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./MyComponent.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; App &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./App.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; myApp &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createApp&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;App&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

myApp&lt;span&gt;.&lt;/span&gt;&lt;span&gt;component&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;my-component&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; MyComponent&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

myApp&lt;span&gt;.&lt;/span&gt;&lt;span&gt;mount&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;#app&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same thing applies to plugins, directives, and mixins. Anything you want to apply globally to a Vue application now needs to be applied to the application instance and not the global &lt;code&gt;Vue&lt;/code&gt; object.&lt;/p&gt;
&lt;p&gt;In this codebase, I have multiple applications. Rather than manually applying multiple global components to each application, the better pattern to use is to make a function that applies the component to our app instance.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt; createApp &lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;// our Global components&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; MyComponent &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./MyComponent.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;// ... imagine 6 or 7 of these&lt;/span&gt;

&lt;span&gt;// our applications&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; PlayArea &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./PlayArea.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; DeckArea &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./DeckArea.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; FlopArea &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./FlopArea.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;import&lt;/span&gt; FinalArea &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&apos;./FinalArea.vue&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;


&lt;span&gt;function&lt;/span&gt; &lt;span&gt;addGlobalComponents&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    app&lt;span&gt;.&lt;/span&gt;&lt;span&gt;component&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;my-component&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; MyComponent&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;// Imagine 6 or 7 components being added here&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; apps &lt;span&gt;=&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;&apos;#play&apos;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; PlayArea&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;&apos;#deck&apos;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; DeckArea&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;&apos;#flop&apos;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; FlopArea&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;&apos;#final&apos;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; FinalArea&lt;span&gt;,&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;for&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;const&lt;/span&gt; el &lt;span&gt;in&lt;/span&gt; apps&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;const&lt;/span&gt; app &lt;span&gt;=&lt;/span&gt; &lt;span&gt;createApp&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;apps&lt;span&gt;[&lt;/span&gt;el&lt;span&gt;]&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;addGlobalComponents&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;app&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  app&lt;span&gt;.&lt;/span&gt;&lt;span&gt;mount&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;el&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This pattern allows us to apply components to multiple Vue app instances and also allows us to define our global components in a separate file if we would like. If you are applying a global set of components, I highly recommend this pattern.&lt;/p&gt;
&lt;h3&gt;Mounting an App&lt;/h3&gt;
&lt;p&gt;As you likely noticed in the previous example, initializing a Vue app has changed a smidge. But there is another change as well. Previously, when you mounted a Vue app, it would replace the DOM element it was binding to. Now with Vue 3, it places the app instance inside that DOM element. This causes some slight weirdness that you can quickly fix.&lt;/p&gt;
&lt;h6&gt;App.vue&lt;/h6&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;template&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span&gt;id&lt;/span&gt;&lt;span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;app&lt;span&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Hello World&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;This is our app!&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;template&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;
  &lt;span&gt;export&lt;/span&gt; &lt;span&gt;default&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;name&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&apos;App&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h6&gt;Rendered DOM&lt;/h6&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;&amp;lt;!-- Previously in Vue 2 --&amp;gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span&gt;id&lt;/span&gt;&lt;span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;app&lt;span&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Hello World&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;This is our app!&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span&gt;&amp;lt;!-- That same component mounted with Vue 3 --&amp;gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span&gt;id&lt;/span&gt;&lt;span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;app&lt;span&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span&gt;id&lt;/span&gt;&lt;span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;app&lt;span&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Hello World&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;This is our app!&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We now have an extra div wrapping things! Fortunately with Vue 3, we can have multiple root elements in our components templates. Here’s how we fix this:&lt;/p&gt;
&lt;h6&gt;App.vue&lt;/h6&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;template&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Hello World&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;This is our app!&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;template&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;
  &lt;span&gt;export&lt;/span&gt; &lt;span&gt;default&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;name&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;&apos;App&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will now render the way we expect it to. I have not done enough exploring to find out what is needed to be able to modify the element that you have mounted to, and that is outside the scope of this post.  Maybe I’ll look into it in another post.&lt;/p&gt;
&lt;h3&gt;Code Splitting&lt;/h3&gt;
&lt;p&gt;The last major hurdle I had to overcome was the least helpful error I’ve run into.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[Vue warn]: Invalid VNode type: undefined (undefined)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This error message is excessively unhelpful and If I had not been aware of some changes between Vue 2 and Vue 3, I likely would have given up with this endeavor. Fortunately, I was aware of this this bit of information:&lt;/p&gt;
&lt;p&gt;From &lt;a href=&quot;https://v3.vuejs.org/guide/migration/async-components.html#introduction&quot;&gt;Async Components:&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Now, in Vue 3, since functional components are defined as pure functions, async components definitions need to be explicitly defined by wrapping it in a new &lt;code&gt;defineAsyncComponent&lt;/code&gt; helper&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What does this mean for us? Let’s look at how I had previously code split my solitaire game:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;const&lt;/span&gt; &lt;span&gt;DeckArea&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/DeckArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; &lt;span&gt;FlopArea&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/FlopArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; &lt;span&gt;FinalArea&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/FinalArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; &lt;span&gt;PlayArea&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/PlayArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This was the problematic code that was throwing the extremely vague error. Vue will no longer render a function that returns a promise to a component without some help due to how the underlying system works. (I’ve gone ahead and filed an issue &lt;a href=&quot;https://github.com/vuejs/vue-next/issues/2497&quot;&gt;here&lt;/a&gt; to make the message a bit more helpful.) You now need to pass this function to a helper function from vue first:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;import&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;defineAsyncComponent&lt;span&gt;}&lt;/span&gt; &lt;span&gt;from&lt;/span&gt; &lt;span&gt;&quot;vue&quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;const&lt;/span&gt; DeckApp &lt;span&gt;=&lt;/span&gt; &lt;span&gt;defineAsyncComponent&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/DeckArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; FlopApp &lt;span&gt;=&lt;/span&gt; &lt;span&gt;defineAsyncComponent&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/FlopArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; FinalApp &lt;span&gt;=&lt;/span&gt; &lt;span&gt;defineAsyncComponent&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/FinalArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;span&gt;const&lt;/span&gt; PlayApp &lt;span&gt;=&lt;/span&gt; &lt;span&gt;defineAsyncComponent&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;=&amp;gt;&lt;/span&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;@components/PlayArea.vue&quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;defineAsyncComponent&lt;/code&gt; wraps our function call in an object that has some extra helpers to handle loading and error states, and once I figured this out, then everything worked exactly as I was expecting it to!&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Updating vue-solitaire from Vue 2 to Vue 3 surprisingly only took me a couple of hours. I had been ready to dedicate half a day or more to updating this small application, and was pleasantly surprised at how easy it was to do. There were a few more things I knew I was going to run into and quickly fixed, but these were the 3 that caught me off guard. I hope this helps someone else!&lt;/p&gt;</content:encoded></item><item><title>Comments are here!</title><link>https://alex.party/posts/2020-09-02-comments-are-here/</link><guid isPermaLink="true">https://alex.party/posts/2020-09-02-comments-are-here/</guid><pubDate>Wed, 02 Sep 2020 23:15:52 GMT</pubDate><content:encoded>&lt;p&gt;I have now added comments to my site.&lt;/p&gt;
&lt;p&gt;I am trying out using &lt;a href=&quot;https://utteranc.es&quot;&gt;utteranc.es&lt;/a&gt; as my commenting system. This integrates with the github issues for &lt;a href=&quot;https://github.com/fimion/alex-party&quot;&gt;my blog’s repo&lt;/a&gt; and so we will see how well this works.&lt;/p&gt;
&lt;p&gt;I fully expect no one to comment.&lt;/p&gt;
&lt;p&gt;But if you do: Hey, you’re awesome.&lt;/p&gt;</content:encoded></item><item><title>ES6 Classes, Object Prototypes, and Enumeration</title><link>https://alex.party/posts/2020-08-19-es6-classes-object-prototypes-and-enumeration/</link><guid isPermaLink="true">https://alex.party/posts/2020-08-19-es6-classes-object-prototypes-and-enumeration/</guid><pubDate>Wed, 19 Aug 2020 00:04:41 GMT</pubDate><content:encoded>&lt;p&gt;ES6 classes have been around for a little while now, so let’s talk about a key difference between using them and using a more traditional object prototype extending method of creating JavaScript classes.&lt;/p&gt;
&lt;p&gt;At work the other day I ran into a bit of code I was trying to test that relied on &lt;a href=&quot;https://github.com/googlemaps/v3-utility-library/tree/master/packages/markerclustererplus&quot;&gt;@google/markerclustererplus&lt;/a&gt; and google maps. Google has released &lt;a href=&quot;https://github.com/googlemaps/v3-utility-library/tree/master/packages/jest-mocks&quot;&gt;@googlemaps/jest-mocks&lt;/a&gt; which helps some with the problems I was running into, but they do not appear to be using their own mocks library to test markerclustererplus.&lt;/p&gt;
&lt;h2&gt;The Issue&lt;/h2&gt;
&lt;p&gt;The specific lines of code I was getting hung up on were the following lines:&lt;/p&gt;
&lt;h3&gt;From &lt;a href=&quot;https://github.com/googlemaps/v3-utility-library/blob/c6b74da7eb6748b404c0174e35d217d973560b09/packages/markerclustererplus/src/overlay-view-safe.ts#L28-L33&quot;&gt;overlay-view-safe.ts&lt;/a&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;function&lt;/span&gt; &lt;span&gt;extend&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;type1&lt;span&gt;:&lt;/span&gt; &lt;span&gt;any&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; type2&lt;span&gt;:&lt;/span&gt; &lt;span&gt;any&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;void&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;// eslint-disable-next-line prefer-const&lt;/span&gt;
  &lt;span&gt;for&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;let&lt;/span&gt; property &lt;span&gt;in&lt;/span&gt; type2&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    type1&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;[&lt;/span&gt;property&lt;span&gt;]&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; type2&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;[&lt;/span&gt;property&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The error I was encountering was that it couldn’t find method that I knew was mocked out. This is where I discovered a difference between using ES6 classes and an binding to the Object prototype. ES6 Classes do not allow their public properties on their prototype be enumerated by default.&lt;/p&gt;
&lt;h2&gt;WAT&lt;/h2&gt;
&lt;p&gt;So let me back up and explain a couple of things first. &lt;code&gt;Object.defineProperty&lt;/code&gt; allows you to define new properties on an object. When doing this, you can define a few things about the new property: &lt;code&gt;writable&lt;/code&gt;, &lt;code&gt;configurable&lt;/code&gt;, and &lt;code&gt;enumerable&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;const&lt;/span&gt; o &lt;span&gt;=&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

Object&lt;span&gt;.&lt;/span&gt;&lt;span&gt;defineProperty&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;o&lt;span&gt;,&lt;/span&gt; &lt;span&gt;&apos;a&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;value&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;1&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;writable&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;true&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;configurable&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;true&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;enumerable&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;true&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;o&lt;span&gt;.&lt;/span&gt;a&lt;span&gt;)&lt;/span&gt; &lt;span&gt;// prints: 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;writable&lt;/code&gt; is whether the value can be reassigned or not. &lt;code&gt;configurable&lt;/code&gt; is whether you can redefine things about the property. &lt;code&gt;enumerable&lt;/code&gt; is whether or not you can loop over it or not. (This is an oversimplification and you should definitely &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty&quot;&gt;read more about this&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;When you define an ES6 class using the &lt;code&gt;class&lt;/code&gt; keyword, any method you define for the class is defined on its prototype and the &lt;code&gt;enumerable&lt;/code&gt; property is set to &lt;code&gt;false&lt;/code&gt;. This is different than just simply adding a new method or property to the prototype, where &lt;code&gt;enumerable&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;Examples&lt;/h2&gt;
&lt;p&gt;So what does this mean and how does this relate to my problem? Well, let’s talk about some examples of this.&lt;/p&gt;
&lt;p&gt;If I use the older style syntax for creating a new Class called &lt;code&gt;MyType&lt;/code&gt; by adding methods to the prototype, then we have this lovely syntax here:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;function&lt;/span&gt; &lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;// Do constructor stuff...&lt;/span&gt;
  &lt;span&gt;return&lt;/span&gt; &lt;span&gt;this&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;.&lt;/span&gt;&lt;span&gt;myMethod&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; &lt;span&gt;function&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;// Do some stuff...&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;

&lt;span&gt;for&lt;/span&gt;&lt;span&gt;(&lt;/span&gt; &lt;span&gt;let&lt;/span&gt; key &lt;span&gt;in&lt;/span&gt; &lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;prototype &lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;key&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;span&gt;// prints &apos;myMethod&apos;&lt;/span&gt;

console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;.&lt;/span&gt;myMethod&lt;span&gt;)&lt;/span&gt; &lt;span&gt;// [Function]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is expected and absolutely what we want in the case of what &lt;code&gt;MarkerClustererPlus&lt;/code&gt; is doing. We want to iterate over the keys of the prototype and rebind them.&lt;/p&gt;
&lt;p&gt;Let’s look at making the same thing but with ES6 Class syntax:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;class&lt;/span&gt; &lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;constructor&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;// Do constructor stuff...&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;

    &lt;span&gt;myMethod&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;// Do some stuff...&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;for&lt;/span&gt;&lt;span&gt;(&lt;/span&gt; &lt;span&gt;let&lt;/span&gt; key &lt;span&gt;in&lt;/span&gt; &lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;prototype &lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
  console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;key&lt;span&gt;)&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;span&gt;// Nothing happens&lt;/span&gt;

console&lt;span&gt;.&lt;/span&gt;&lt;span&gt;log&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;MyType&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;.&lt;/span&gt;myMethod&lt;span&gt;)&lt;/span&gt; &lt;span&gt;// [Function: myMethod]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So with this example, even though we have &lt;code&gt;myMethod&lt;/code&gt; on the prototype, it isn’t accessible via enumeration.&lt;/p&gt;
&lt;p&gt;So looking back at our original code we were trying to debug:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;function&lt;/span&gt; &lt;span&gt;extend&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;type1&lt;span&gt;:&lt;/span&gt; &lt;span&gt;any&lt;/span&gt;&lt;span&gt;,&lt;/span&gt; type2&lt;span&gt;:&lt;/span&gt; &lt;span&gt;any&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;void&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
  &lt;span&gt;// eslint-disable-next-line prefer-const&lt;/span&gt;
  &lt;span&gt;for&lt;/span&gt; &lt;span&gt;(&lt;/span&gt;&lt;span&gt;let&lt;/span&gt; property &lt;span&gt;in&lt;/span&gt; type2&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    type1&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;[&lt;/span&gt;property&lt;span&gt;]&lt;/span&gt; &lt;span&gt;=&lt;/span&gt; type2&lt;span&gt;.&lt;/span&gt;prototype&lt;span&gt;[&lt;/span&gt;property&lt;span&gt;]&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The problem I was having was that code being used to add the 2 methods that this library needs expects the prototype to be enumerable. However, I had made the mistake in adding a Mock class using ES6 Class syntax. the methods were not found, and it took me a bit to figure out why that was happening.&lt;/p&gt;
&lt;p&gt;So I rewrote our mock to use the classic prototype binding style, and the tests passed.&lt;/p&gt;
&lt;p&gt;All of this is to say, JavaScript is weird sometimes.&lt;/p&gt;</content:encoded></item><item><title>Gif to SVG - A Story</title><link>https://alex.party/posts/2019-06-02-gif-to-svg-a-story/</link><guid isPermaLink="true">https://alex.party/posts/2019-06-02-gif-to-svg-a-story/</guid><pubDate>Sun, 02 Jun 2019 12:54:54 GMT</pubDate><content:encoded>&lt;p&gt;I recently have updated the styling of my site to have a bit more… character?&lt;/p&gt;
&lt;p&gt;The other day someone linked me to &lt;a href=&quot;http://www.dory-funk.com/&quot;&gt;dory-funk.com&lt;/a&gt; and I was immediately mesmerized by the background. It reminded me of my early days of the internet and messing around with HTML at that time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I opened up the background in a separate tab and watched it. After a bit, I thought to myself, “Couldn’t you achieve this with SVG?” and thus began several hours of painstakingly recreating it by hand as an SVG. Animations and all.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This brings us to now. I have updated the styling of my site to have a bit of the old school retro feel while also using modern forms of styling.&lt;/p&gt;
&lt;p&gt;I think my goal is to do something interesting with this background. I intend to keep messing with it, but ultimately, I want it to be able to respect &lt;code&gt;prefers-reduced-motion&lt;/code&gt; to remove the animated bits.&lt;/p&gt;
&lt;p&gt;Everyone enjoy!&lt;/p&gt;</content:encoded></item><item><title>Connect.Tech 2019 Talk - Dependency Injection in Vue.js</title><link>https://alex.party/posts/2020-01-14-connect-tech-2019-talk/</link><guid isPermaLink="true">https://alex.party/posts/2020-01-14-connect-tech-2019-talk/</guid><pubDate>Tue, 14 Jan 2020 00:52:02 GMT</pubDate><content:encoded>&lt;p&gt;I had the pleasure of giving my talk “Dependency Injection in Vue.js” at Connect.Tech 2019. Here’s where you can see more about it.&lt;/p&gt;
&lt;p&gt;Video: &lt;a href=&quot;https://vimeo.com/384465021&quot;&gt;ConnectTech2019 - Dependency Injection in Vue - Alex Riviere&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Slides: &lt;a href=&quot;https://slides.com/fimion/connect-tech-2019#/&quot;&gt;https://slides.com/fimion/connect-tech-2019#/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Codepen Examples: &lt;a href=&quot;https://codepen.io/collection/AaLZBm&quot;&gt;https://codepen.io/collection/AaLZBm&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>New Talk: Why Vue.js?</title><link>https://alex.party/posts/2019-04-11-new-talk-why-vue-js/</link><guid isPermaLink="true">https://alex.party/posts/2019-04-11-new-talk-why-vue-js/</guid><pubDate>Thu, 11 Apr 2019 14:15:33 GMT</pubDate><content:encoded>&lt;p&gt;My first pass at a talk that is an intro to Vue.js and how you can use it without a build step.&lt;/p&gt;
&lt;a href=&quot;https://www.twitch.tv/videos/407876453?tt_content=text_link&amp;amp;tt_medium=vod_embed&quot;&gt;Watch Highlight: Why Vue.js? - A First Pass from Fimion on www.twitch.tv&lt;/a&gt;</content:encoded></item><item><title>Added RSS Feed</title><link>https://alex.party/posts/2019-04-01-added-rss-feed/</link><guid isPermaLink="true">https://alex.party/posts/2019-04-01-added-rss-feed/</guid><pubDate>Mon, 01 Apr 2019 14:38:28 GMT</pubDate><content:encoded>&lt;p&gt;Huzzah for feed readers!&lt;/p&gt;
&lt;p&gt;I’ve added an rss feed to the blog, so in theory, you can now subscribe in your favorite feed reader. At the moment, it only has the excerpt, and not the content. If there is interest in the content being in there, I will look into that.&lt;/p&gt;
&lt;p&gt;You should leave a comment… ohhhh… hmmm…&lt;/p&gt;
&lt;p&gt;Next on my to-do list will be adding a comment system!&lt;/p&gt;</content:encoded></item><item><title>Redirecting Alex.party</title><link>https://alex.party/posts/2019-03-30-redirecting-alex-party/</link><guid isPermaLink="true">https://alex.party/posts/2019-03-30-redirecting-alex-party/</guid><pubDate>Sat, 30 Mar 2019 13:02:31 GMT</pubDate><content:encoded>&lt;p&gt;Thoughts on moving to a new system.&lt;/p&gt;
&lt;p&gt;I am currently moving &lt;a href=&quot;https://alex.party&quot;&gt;alex.party&lt;/a&gt; over to the netlify name servers. Soon this will be the new home of my blog! Maybe I can also get some of my other old domains pointing here too.&lt;/p&gt;
&lt;p&gt;Anyway, I wanted to make a system that was more maintainable than the old system. The old system was an early attempt at making a blog in vue and I will likely salvage what I can from it. This is backed by the &lt;a href=&quot;https://netlifycms.org&quot;&gt;netlifycms&lt;/a&gt; which is ridiculously handy for building static sites.&lt;/p&gt;
&lt;p&gt;Another thing i am going to hopefully implement is an actual RSS feed for this blog. I just need to get gridsome set up with that.&lt;/p&gt;
&lt;p&gt;Alright, I’m going to finish my coffee and greet the new day.&lt;/p&gt;</content:encoded></item><item><title>First post</title><link>https://alex.party/posts/2019-03-30-first-post/</link><guid isPermaLink="true">https://alex.party/posts/2019-03-30-first-post/</guid><pubDate>Sat, 30 Mar 2019 02:29:42 GMT</pubDate><content:encoded>&lt;p&gt;Hello world!&lt;/p&gt;
&lt;p&gt;I’m rebooting my blog as a gridsome site. because it’s like gatsby but for vue… or at least that is my understanding. Let’s see how this goes…&lt;/p&gt;</content:encoded></item><item><title>Vuejs Dependency Injection - 2 Way Provide/Inject Data Binding</title><link>https://alex.party/posts/2018-05-12-vuejs-dependency-injection-2-way-provide-inject-data-binding/</link><guid isPermaLink="true">https://alex.party/posts/2018-05-12-vuejs-dependency-injection-2-way-provide-inject-data-binding/</guid><pubDate>Sat, 12 May 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;em&gt;&lt;strong&gt;(This post was originally published on CodePen, but I’m putting it here. Enjoy!)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is a follow up post to &lt;a href=&quot;/posts/2018-04-19-vuejs-and-dependency-injection&quot;&gt;my previous post about Vuejs and Dependency Injection&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In my previous post, I described a couple of ways to use &lt;code&gt;provide&lt;/code&gt; and &lt;code&gt;inject&lt;/code&gt; in Vue components. In this post I’m going to cover how to use &lt;code&gt;provide&lt;/code&gt;/&lt;code&gt;inject&lt;/code&gt; reactively. This method is not recommended, and we will go over some pros and cons of this method.&lt;/p&gt;
&lt;h2&gt;Demo&lt;/h2&gt;
&lt;p&gt;First, let’s make a property &lt;code&gt;thing&lt;/code&gt; in a parent component have 2 way data binding to a nested child using &lt;code&gt;provide&lt;/code&gt; and &lt;code&gt;inject&lt;/code&gt;&lt;/p&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/BxxpxZ&quot;&amp;gt;
  VueJs - Provide and Inject - Dependency Injection - Getter and Setter&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;h2&gt;Explanation&lt;/h2&gt;
&lt;p&gt;In the parent component we have a property called &lt;code&gt;thing&lt;/code&gt;. Our &lt;code&gt;methods&lt;/code&gt; and &lt;code&gt;provide&lt;/code&gt; sections look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;export&lt;/span&gt; &lt;span&gt;default&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
&lt;span&gt;// ...&lt;/span&gt;
  &lt;span&gt;methods&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;getThing&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;function&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;return&lt;/span&gt; &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;thing&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;setThing&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;function&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;thing &lt;span&gt;=&lt;/span&gt; data&lt;span&gt;;&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;provide&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;function&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;return&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;getThing&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;getThing&lt;span&gt;,&lt;/span&gt;
        &lt;span&gt;setThing&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;setThing
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
&lt;span&gt;// ...&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you type into either of the 2 text boxes in the above example, it updates. This is what we want.&lt;/p&gt;
&lt;p&gt;In this example, our parent component is providing 2 functions to it’s children. Because of the way that Javascript scoping works, when these functions are used, they will always refer to the values in the parent component.&lt;/p&gt;
&lt;p&gt;To use this in our nested component, we need to make a computed property. Doing this, Vue will update the values on changes. Our nested components &lt;code&gt;computed&lt;/code&gt; and &lt;code&gt;inject&lt;/code&gt; sections are as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span&gt;export&lt;/span&gt; &lt;span&gt;default&lt;/span&gt; &lt;span&gt;{&lt;/span&gt;
&lt;span&gt;// ...&lt;/span&gt;
  &lt;span&gt;computed&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
    &lt;span&gt;thing&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
      &lt;span&gt;get&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;return&lt;/span&gt; &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;getThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
      &lt;span&gt;set&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;d&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;
        &lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;setThing&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;d&lt;span&gt;)&lt;/span&gt;
      &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
    &lt;span&gt;}&lt;/span&gt;
  &lt;span&gt;}&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
  &lt;span&gt;inject&lt;/span&gt;&lt;span&gt;:&lt;/span&gt; &lt;span&gt;[&lt;/span&gt;&lt;span&gt;&quot;getThing&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&quot;setThing&quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;
&lt;span&gt;// ...&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In our &lt;code&gt;computed&lt;/code&gt; section, all we are doing is making calls to our injected functions.&lt;/p&gt;
&lt;p&gt;If you attempt to directly bind the injected values to &lt;code&gt;get&lt;/code&gt; and &lt;code&gt;set&lt;/code&gt; this will only result in &lt;code&gt;thing&lt;/code&gt; showing up as an object, and not as a computed value.&lt;/p&gt;
&lt;h2&gt;Pros and Cons&lt;/h2&gt;
&lt;p&gt;There are some good and bad trade offs about this code pattern.&lt;/p&gt;
&lt;h3&gt;Pros&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;allows you to share state in all children components&lt;/li&gt;
&lt;li&gt;will update when you change the value of the parent&lt;/li&gt;
&lt;li&gt;doesn’t require a full state management solution like vuex&lt;/li&gt;
&lt;li&gt;good for a component library where you need to keep things synced between children&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Cons&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;if you allow children to set the value of the parent, you can cause some unexpected issues if things go out of order&lt;/li&gt;
&lt;li&gt;is not good practice to rely on injected values to be there. It is a better pattern to be explicit about what is available to and needed by a component through props.&lt;/li&gt;
&lt;li&gt;not recommended for most applications if you need to handle a lot of state based changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;provide&lt;/code&gt; and &lt;code&gt;inject&lt;/code&gt; can be used for two way data binding, but it is not recommended for every day projects. However, there may come a time when you realize that you need this, and hopefully you will find this information useful.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/em&gt; Thanks to &lt;a href=&quot;https://news.vuejs.org/issues/94&quot;&gt;The official Vuejs Podcast&lt;/a&gt; for the shout out. Watch my adventures as I try to make a blog over at &lt;a href=&quot;https://alex.party&quot;&gt;Alex.party&lt;/a&gt; or follow me on twitter: &lt;a href=&quot;https://twitter.com/fimion&quot;&gt;@fimion&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>VueJS and Dependency Injection</title><link>https://alex.party/posts/2018-04-19-vuejs-and-dependency-injection/</link><guid isPermaLink="true">https://alex.party/posts/2018-04-19-vuejs-and-dependency-injection/</guid><pubDate>Thu, 19 Apr 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;em&gt;&lt;strong&gt;(This post was originally published on CodePen, but I’m putting it here. Enjoy!)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I was reading the recently updated &lt;a href=&quot;https://vuejs.org/v2/guide/components-registration.html&quot;&gt;Vue docs&lt;/a&gt; and saw a bit about &lt;a href=&quot;https://vuejs.org/v2/guide/components-edge-cases.html#Dependency-Injection&quot;&gt;Dependency Injection&lt;/a&gt;, &lt;code&gt;provide&lt;/code&gt;, and &lt;code&gt;inject&lt;/code&gt;. I hadn’t ever noticed these features before. The docs give an example of utilizing this for google maps, but don’t really give examples of it otherwise. I felt I should experiment with it some.&lt;/p&gt;
&lt;p&gt;First off, what are &lt;code&gt;provide&lt;/code&gt; and &lt;code&gt;inject&lt;/code&gt;? &lt;code&gt;provide&lt;/code&gt; is an API in Vue that lets you specify values that’ll get passed down into components nested within this top level component. &lt;code&gt;inject&lt;/code&gt; is the API for getting the values in a nested component. It’s a way to not have to pass &lt;code&gt;props&lt;/code&gt; to every component or go looking for attributes on &lt;code&gt;$parent&lt;/code&gt;. The downside to &lt;code&gt;provide&lt;/code&gt; is that it isn’t reactive. Here’s a simple example:&lt;/p&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/mLymma&quot;&amp;gt;
  VueJs - Provide and Inject - Dependency Injection - No Update&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;In this pen you can see, that while the &lt;code&gt;app&lt;/code&gt; instance can change its &lt;code&gt;thing&lt;/code&gt; value, the nested component doesn’t receive those updates.&lt;/p&gt;
&lt;p&gt;Well, this feature seems less useful, right? Well… Sort of… Let’s see if we can use &lt;code&gt;provide&lt;/code&gt; to update a nested value later…&lt;/p&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/wjBdqw&quot;&amp;gt;
  VueJs - Provide and Inject - Dependency Injection - Promise&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;In this example, I’ve made &lt;code&gt;provide&lt;/code&gt; pass a &lt;code&gt;Promise&lt;/code&gt; that is resolved by a Vue event. That event is triggered when you push the update button at which point it resolves the &lt;code&gt;Promise&lt;/code&gt; and passes the value of &lt;code&gt;thing&lt;/code&gt; to the nested component. This isn’t very useful in this fashion, but let’s say you have a &lt;code&gt;fetch&lt;/code&gt; statement that should resolve and you want your nested components to change from their loading state. This would be a way to do that.&lt;/p&gt;
&lt;p&gt;While this is a neat trick, you probably want to end up using a state management library, like vuex, to handle situations like this however, and these keywords are really meant to be used sparingly.&lt;/p&gt;</content:encoded></item><item><title>Marquee Tags and Flex</title><link>https://alex.party/posts/2017-10-31-marquee-tags-and-flex/</link><guid isPermaLink="true">https://alex.party/posts/2017-10-31-marquee-tags-and-flex/</guid><pubDate>Mon, 30 Oct 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;em&gt;&lt;strong&gt;(This post was originally published on CodePen, but I’m putting it here. Enjoy!)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;What happens if for some reason, you feel the need to use a marquee tag, but also want to use flex box on it?&lt;/p&gt;
&lt;p&gt;Short answers:&lt;/p&gt;
&lt;p&gt;Chrome: Nothing.
Firefox: Nothing.
Edge: Surprisingly, it’s choppy, but it works.
Safari: And surprise surprise, it works here too.&lt;/p&gt;

  See the Pen &amp;lt;a href=&quot;https://codepen.io/fimion/pen/WXbmWN&quot;&amp;gt;
  What Happens when you add flex to a marquee tag?&amp;lt;/a&amp;gt; by Alex Riviere (&amp;lt;a href=&quot;https://codepen.io/fimion&quot;&amp;gt;@fimion&amp;lt;/a&amp;gt;)
  on &amp;lt;a href=&quot;https://codepen.io&quot;&amp;gt;CodePen&amp;lt;/a&amp;gt;.

&lt;p&gt;Come on Google and Mozilla.&lt;/p&gt;</content:encoded></item></channel></rss>