<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: RATIU5</title>
    <description>The latest articles on DEV Community by RATIU5 (@ratiu5).</description>
    <link>https://dev.to/ratiu5</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F861695%2F152811a2-5c42-4ad9-a678-9683495452d2.png</url>
      <title>DEV Community: RATIU5</title>
      <link>https://dev.to/ratiu5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ratiu5"/>
    <language>en</language>
    <item>
      <title>I Don't Like Existing CMS Options, So I'm Building a New One</title>
      <dc:creator>RATIU5</dc:creator>
      <pubDate>Wed, 18 Dec 2024 02:30:01 +0000</pubDate>
      <link>https://dev.to/ratiu5/i-dont-like-existing-cms-options-so-im-building-a-new-one-4d7p</link>
      <guid>https://dev.to/ratiu5/i-dont-like-existing-cms-options-so-im-building-a-new-one-4d7p</guid>
      <description>&lt;p&gt;Here is a &lt;del&gt;complete&lt;/del&gt; incomplete list of &lt;del&gt;all&lt;/del&gt; most CMS solutions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://apostrophecms.com/" rel="noopener noreferrer"&gt;Apostrophe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.builder.io/" rel="noopener noreferrer"&gt;Builder.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://buttercms.com/" rel="noopener noreferrer"&gt;Butter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://caisy.io/" rel="noopener noreferrer"&gt;caisy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloudcannon.com/" rel="noopener noreferrer"&gt;cloudcannon&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.datocms.com/" rel="noopener noreferrer"&gt;Dato&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crystallize.com/" rel="noopener noreferrer"&gt;Crystallize&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://craftcms.com/" rel="noopener noreferrer"&gt;Craft&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.cosmicjs.com/" rel="noopener noreferrer"&gt;Cosmic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.contentful.com/" rel="noopener noreferrer"&gt;Contentful&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://decapcms.org/" rel="noopener noreferrer"&gt;Decap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://directus.io/" rel="noopener noreferrer"&gt;Directus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://new.drupal.org/home" rel="noopener noreferrer"&gt;Drupal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://flotiq.com/" rel="noopener noreferrer"&gt;Flotiq&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://frontmatter.codes/" rel="noopener noreferrer"&gt;FrontMatter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://keystonejs.com/" rel="noopener noreferrer"&gt;Keystone&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://keystatic.com/" rel="noopener noreferrer"&gt;Keystatic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hygraph.com/" rel="noopener noreferrer"&gt;hygraph&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hashnode.com/" rel="noopener noreferrer"&gt;Hashnode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ghost.org/" rel="noopener noreferrer"&gt;Ghost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kontent.ai/" rel="noopener noreferrer"&gt;Kontent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://microcms.io/en" rel="noopener noreferrer"&gt;microCMS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://payloadcms.com/" rel="noopener noreferrer"&gt;Payload&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://prepr.io/" rel="noopener noreferrer"&gt;Prepr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://prismic.io/" rel="noopener noreferrer"&gt;Prismic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.storyblok.com/" rel="noopener noreferrer"&gt;Storyblok&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://statamic.com/" rel="noopener noreferrer"&gt;Statamic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.sitecore.com/products/experience-manager" rel="noopener noreferrer"&gt;Sitecore XM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.sanity.io/" rel="noopener noreferrer"&gt;Sanity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://strapi.io/" rel="noopener noreferrer"&gt;Strapi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tina.io/" rel="noopener noreferrer"&gt;TinaCMS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://umbraco.com/" rel="noopener noreferrer"&gt;Umbraco&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wordpress.org/" rel="noopener noreferrer"&gt;Wordpress&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why the Heck Are You Building a New One Then?
&lt;/h2&gt;

&lt;p&gt;Good question. There are a plethora of CMS options to choose from, and many of them are free. What's the point in creating a new one? Can't you just make any one work for my use case?&lt;/p&gt;

&lt;p&gt;That's it! I have to make it "work for my use case", which really means I need to bend and twist existing solutions until they fit perfectly with what I got. Or I need to pick a CMS and use their recommended technology stack. At some point, you have to ask yourself: wouldn't it be more efficient to use something that aligns with my workflows and technology stack?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuymug3tjplula4hqi0rm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuymug3tjplula4hqi0rm.gif" alt="Kid tries to put square toy peg in round hole" width="230" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I sure have. And that's where the idea came from: Why not add another to that list?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Current Ecosystem
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4i3v5qojwtrkdtg6wl3x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4i3v5qojwtrkdtg6wl3x.jpg" alt="City in the morning" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
(Photo by ben o'bro on Unsplash)&lt;/p&gt;

&lt;p&gt;Honestly I didn't think that was a good idea at first. Each CMS that's out there already solves a problem, but they all seem to solve it with their own set of trade-offs and compromises. After years of working with different systems, I've noticed a pattern: we keep accepting these compromises as "just the way things are" instead of questioning whether they need to exist at all.&lt;/p&gt;

&lt;p&gt;I'm not going to build some magical perfect CMS that does everything for everyone. After time and time again fighting with CMS solutions that either don't understand component-based development or force me to completely change how I work, I'm building something different. I want a CMS that actually gets how we build modern websites and fits naturally into our workflow, not the other way around. I want components, man!&lt;/p&gt;

&lt;p&gt;"Hey, what about Builder.io or Prismic?" I hear. "They let you build components and schemas right out of the box!" And you're absolutely right - these platforms have made huge strides in the right direction. I've used both, and there's a lot to love about their approach.&lt;/p&gt;

&lt;p&gt;But here's the thing that keeps nagging at me: while they're great for certain use cases, they start showing their limitations once you scale up: their cost per page view or per user. Plus, even with all their features, I still found myself wanting just a bit more control over how everything worked together.&lt;br&gt;
Don't get me wrong - they're solid platforms. But I think we can push this idea further without requiring developers to empty their wallets just to handle growing traffic.&lt;/p&gt;

&lt;p&gt;"But wait, what about Payload? It's open-source and has all those features you mentioned!" I hear you. I've been down that road. And yes, Payload is impressive, I actually really like the work their team has done. I just wish I could love it. On top of many issues I faced getting it setup and working for me, I noticed a trend with Payload as well as many others: any CMS that tries to be super flexible while also being simple to use ends up sacrificing something. I've yet to find a CMS that manages to thread that needle perfectly, and honestly, maybe that's okay. Maybe we need to accept that different tools serve different needs, and we need to find the best tool for the job.&lt;/p&gt;

&lt;p&gt;Nope, not me. I think we can do better.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Proposition
&lt;/h2&gt;

&lt;p&gt;Call me crazy, I think there is a better solution. A solution that already exists in different forms, but has proven its worth in other areas of development: composability. The idea that small, focused pieces can be combined to create powerful systems that are both flexible and maintainable.&lt;/p&gt;

&lt;p&gt;Let me introduce to you (if you haven't already met), &lt;a href="https://astro.build" rel="noopener noreferrer"&gt;Astro&lt;/a&gt; and &lt;a href="https://medusajs.com" rel="noopener noreferrer"&gt;Medusa&lt;/a&gt;. These are two amazing feats of engineering. These two projects are built around modularity, especially Medusa. It's simple: you start with a core foundation that handles the essential functionality, and then you can plug in exactly what you need, when you need it. No bloat, no unnecessary features weighing down your project.&lt;/p&gt;

&lt;p&gt;This is exactly the kind of thinking we need in the CMS space. Instead of trying to be everything to everyone out of the box, be a solid foundation that developers can easily extend. A CMS that follows these principles could start lean and grow precisely in the direction any project needs, without forcing developers to work around features they'll never use or features they require.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick shout-out moment&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;If you have not tried out Astro as a modern web development solution for your site, give it a try! Medusa is an amazing product for a complex or custom e-commerce experience! This CMS would not exist without heavy inspiration from these two tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Will Make This CMS Stand Apart?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzw3nuiweyc65xvtb2kzr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzw3nuiweyc65xvtb2kzr.jpg" alt="Puzzle pieces painted on a wall" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
(Photo by Ashkan Forouzani on Unsplash)&lt;/p&gt;

&lt;p&gt;As I stated before, it all revolves around the principle of modularity and composability. Small, independent pieces that fit nicely together, like a puzzle. This core detail will help shape the future of this and hopefully many more CMS solutions.&lt;/p&gt;

&lt;p&gt;Let's look at what core modules I'm planning to feature:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Objects&lt;/strong&gt;: Small key-value pairs of any standard data type: strings, numbers, booleans, arrays, and of course, other objects. This provides the foundation for anyone to create any data type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Documents&lt;/strong&gt;: Documents are essentially larger objects, with special formatting and extra features. Documents are made up of a custom template or schema, which define what data fields will exist. Data can be entered for each of those fields, specific to their own data type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Media&lt;/strong&gt;: Simply put, file uploads. A perfect place to store images, videos, documents, and more all with metadata and attributes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Widgets&lt;/strong&gt;: Widgets are pieces or sections of a website. They can be considered as documents with a twist: they have a custom renderer. This renderer enables a widget to be converted from a component template (ie. Astro, React, Vue, Svelte) into rendered HTML by the framework of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pages&lt;/strong&gt;: Pages work will with widgets, allowing you to put together documents and widgets to form a page, perfect for any modern site. Pages also can be rendered to output page previews with whatever technology stack you are currently using.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These modules will provide the foundation for many new and unique data structures defined by the developers, all of which are extendable via plugins.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's In It For Me?
&lt;/h2&gt;

&lt;p&gt;This is an ambitious project, and I'm well aware of the challenges that lay ahead. I've decided to document every step of this journey openly, from the initial architecture decisions to the inevitable roadblocks I'll face. My experience has taught me that even failed projects can be valuable learning opportunities for the developer community. When I was starting out, I learned lots of valuable lessons from other developers who were open about their struggles and decision-making processes.&lt;/p&gt;

&lt;p&gt;I'm putting my heart into this project because I genuinely believe it can succeed. My goal isn't to build another CMS, but to demonstrate that we can challenge the status quo when we see problems worth solving, even if we are the only ones with that problem (honestly, if we've faced a problem before, I can almost guarentee someone else has faced that same problem ;) ). If this CMS takes off, that's fantastic. But even if it only serves to inspire other developers to tackle ambitious projects they care about, or helps someone else build a better solution down the line, I'll consider that a win. After all, every innovation in our field started with someone looking at a problem and thinking "I believe there's a better way." Which leads me to the actual project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing LuxeCMS
&lt;/h2&gt;

&lt;p&gt;The project has taken the name of LuxeCMS, and will be a &lt;strong&gt;100% open-source&lt;/strong&gt; project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/luxeCMS/luxe" rel="noopener noreferrer"&gt;https://github.com/luxeCMS/luxe&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just to be transparent, this is still in its early stages and nowhere near ready for real-world use yet. But I'm excited to connect with other developers who've faced the same CMS frustrations I have. My hope is that together, we can build something that actually addresses the pain points we've all experienced firsthand.&lt;/p&gt;

&lt;p&gt;If you are excited about the potential future of this project, consider giving it a star! And if you're interested in contributing to or sponsoring this project, reach out to me on &lt;a href="https://discord.gg/6XzN3e8VCk" rel="noopener noreferrer"&gt;our Discord server&lt;/a&gt; and let's chat!&lt;/p&gt;

&lt;p&gt;I'm excited for this opportunity to grow as a developer, and to build a community of like-minded individuals to bring something new to the world! If you've experienced pain points of existing CMS solutions or are excited about this project, comment down below!&lt;/p&gt;

&lt;p&gt;If you want to follow updates on LuxeCMS, consider following us on &lt;a href="https://x.com/luxecms_dev" rel="noopener noreferrer"&gt;X/Twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cms</category>
      <category>webdev</category>
      <category>marketing</category>
      <category>programming</category>
    </item>
    <item>
      <title>Implementing Signals from Scratch</title>
      <dc:creator>RATIU5</dc:creator>
      <pubDate>Thu, 28 Sep 2023 00:45:34 +0000</pubDate>
      <link>https://dev.to/ratiu5/implementing-signals-from-scratch-3e4c</link>
      <guid>https://dev.to/ratiu5/implementing-signals-from-scratch-3e4c</guid>
      <description>&lt;h2&gt;
  
  
  What Are Signals?
&lt;/h2&gt;

&lt;p&gt;Recently, the JavaScript community has been buzzing about signals. Their rise in popularity can be traced back to Solid.js, which drew inspiration from Knockout.js' &lt;a href="https://knockoutjs.com/documentation/observables.html#observables"&gt;Observables&lt;/a&gt; to craft their version of signals. Not long after, prominent frameworks like Preact, Angular, and Qwik integrated signals into their core. Vue 3 introduced its distinctive take on signals with &lt;code&gt;ref&lt;/code&gt; and &lt;code&gt;reactive&lt;/code&gt; (although they are not signals in the same context as Solid.js' signals), while Svelte 5 unveiled the Svelte Runes which is fundamentally built on this type of reactivity. For the purpose of this article, I'll use the term "signals" to describe these reactive systems. With that said, what the heck are signals?&lt;/p&gt;

&lt;p&gt;Signals are basic units of data that can automatically alert functions or computations when the data they hold changes. This alerting capability allows parts of a system to automatically and immediately update when the data changes, making the system feel dynamic and real-time. The problem this solves is updating something visually when some data changes behind-the-scenes.&lt;/p&gt;

&lt;p&gt;When data changes, a function is triggered to update a specific element on the DOM. Solid.js achieves this with fine-grained reactivity. This ensures that your code directly updates only the specified value, avoiding unnecessary side effects or redundant re-renders of other DOM elements. With a defined reactive system in place, you can build large-scale and maintainable web applications with ease.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Do Signals Work?
&lt;/h2&gt;

&lt;p&gt;Let's look at how signals work under-the-hood. I will be referring mostly to Solid's functional approach of signals, although a class-based solution wouldn't be too different. The signal function we will be creating today isn't going to be as performant or feature-full as with many frameworks, but should serve instead as a starting point to understanding signals at a low level.&lt;/p&gt;

&lt;h3&gt;
  
  
  Functions and Closures
&lt;/h3&gt;

&lt;p&gt;Before we look at signals, it's important to have a grasp of how JavaScript handles functions. Let's dive deep into how those work, starting with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's dive in. The function createSignal is stored in JavaScript's global memory. Simple enough, right?&lt;/p&gt;

&lt;p&gt;Next, we'll embed a variable within our function and return another function to retrieve this value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our function now gets a little more complex, and shows the creative inner workings of JavaScript. By invoking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We initiate a fresh execution context for createSignal. Within that context, the string "Hello, World" is assigned to our context's memory under the value label. When we return the new function, a closure is created that holds the &lt;code&gt;value&lt;/code&gt; data, and is stored alongside the returned function. This allows us to have persistent storage of our &lt;code&gt;value&lt;/code&gt; across execution contexts.&lt;/p&gt;

&lt;p&gt;Upon invoking the returned function, JavaScript sets up a new execution environment. Since it doesn't immediately spot the value variable, it consults the closure, locates value, and duly returns it.&lt;/p&gt;

&lt;p&gt;Now, let's modify our function. We will now return an object with a setter function and the value. Then we will add a parameter that receives a default argument for our value as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have one problem. Because we are returning the &lt;code&gt;value&lt;/code&gt; variable within our object, it remains unchanged even after calling our set function. This happens because the value we pass to the object is a copy of the value at the point in time where we return the object from the function. Hence we need to write a dedicated getter function for the value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's coming together! Let's try using it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One thing that stands out is the need to call a set and get function each time we read or write to the &lt;code&gt;value&lt;/code&gt; variable. Let's improve this by using JavaScript's get and set functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can use our function as such:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A bit more readable, eh? We still have one problem: it's not reactive. No "effect" happens aside of the &lt;code&gt;_value&lt;/code&gt; changing states when we call the set function. This is where we will create a subscriber.&lt;/p&gt;

&lt;h2&gt;
  
  
  Subscribers
&lt;/h2&gt;

&lt;p&gt;A subscriber will "subscribe" a function to run some code whenever our &lt;code&gt;_value&lt;/code&gt; changes. To do this, we will be making use of our get function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
      &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's happening here? Whenever the set function is called (aka. we reassign the value &lt;code&gt;signal.value = "hello";&lt;/code&gt;), we will run a function. This function will then call the subscriber function... which means we also need a subscribe function as part of our return. While were at it, let's accommodate for multiple subscribers and then call them within our notify function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;subscribers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;subscriber&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;subscribers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
      &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;subscribers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Finished Signal
&lt;/h2&gt;

&lt;p&gt;And with that, we have a (very) basic signal! Let's see how we will use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Signals from Scratch&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"mySpan"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;subscribers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

      &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;subscriber&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;subscribers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;_value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="nx"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;subscribers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mySignal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;mySignal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mySpan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;mySignal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's happening here is we defined a variable &lt;code&gt;mySignal&lt;/code&gt; to hold our reactive signal. We call the &lt;code&gt;subscribe&lt;/code&gt; method on our returned and bind a function that will be called whenever our &lt;code&gt;value&lt;/code&gt; setter is called which will in turn update the DOM. Now whenever we set the value of our signal, our subscriber is notified and the DOM is updated!&lt;/p&gt;

&lt;p&gt;At the root, this is what's happening with signals. Of course, frameworks implement lots of additional features like derives and effects. In Solid's case, they make use of additional improvements to performance with the use of subscriber cleanups and a compilation step to check where you use the getter within your JSX and create the fine-grained update code from that.&lt;/p&gt;

&lt;p&gt;That's it! If you notice any mistakes, please let me know in a comment and I will do my best to fix it. Feel free to give your thoughts and improvements to this as well!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>development</category>
      <category>frontend</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Beginners should use a preconfigured Neovim distribution</title>
      <dc:creator>RATIU5</dc:creator>
      <pubDate>Wed, 23 Aug 2023 19:52:06 +0000</pubDate>
      <link>https://dev.to/ratiu5/beginners-should-use-a-preconfigured-neovim-distribution-253p</link>
      <guid>https://dev.to/ratiu5/beginners-should-use-a-preconfigured-neovim-distribution-253p</guid>
      <description>&lt;p&gt;I believe that beginners to Neovim &lt;strong&gt;should&lt;/strong&gt; use a preconfigured distribution. I'm talking about distributions such as &lt;a href="https://www.lunarvim.org/"&gt;LunarVim&lt;/a&gt;, &lt;a href="https://nvchad.com/"&gt;NvChad&lt;/a&gt;, &lt;a href="https://astronvim.com/"&gt;AstroVim&lt;/a&gt;, or &lt;a href="https://www.lazyvim.org/"&gt;LazyVim&lt;/a&gt;, among others.&lt;/p&gt;

&lt;p&gt;I've used everything from my own minimal configurations to huge, sometimes bloated, distributions like LunarVim. From my experience, I still believe that those starting out should look toward using a preconfigured distribution and at a later time tailor their own.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Whole New World
&lt;/h2&gt;

&lt;p&gt;Coming from a "managed" editor, newcomers may get overwhelmed with the sheer number of choices that come with Neovim. Unless you use Arch (btw), then you're used to it. A preconfigured Neovim setup lightens the configuration load. &lt;br&gt;
My main complaint about the ecosystem is that it's too vast; the countless plugins, unlimited configurations, and the knowledge needed to get started is bewildering. That's where a preconfigured distribution comes into play.&lt;/p&gt;

&lt;p&gt;These configurations act as curated showcases, offering a glimpse of what plugins and configuration types are available. By trying different distributions, you figure out which plugins and settings resonate with your unique coding style and requirements. It's like finding the right pair of shoes in an infinite store; each fits and feels differently, and you'll never truly know what's comfortable until you've tried several. &lt;/p&gt;

&lt;h2&gt;
  
  
  Monkey See, Monkey Do
&lt;/h2&gt;

&lt;p&gt;The exposure to different types of configurations helps guide newbies on different ways to write their own. I know that after looking at several different formats I found what stuck to me. Yes I am referring to using other's configurations as a reference too. Try them out first, then delve in deep and see how it was done.&lt;/p&gt;

&lt;p&gt;By exploring different Neovim configurations, you get inspiration from the tried-and-tested configurations. After some time, it is easy to modify the configurations a little more to your liking. &lt;/p&gt;

&lt;h2&gt;
  
  
  Don't Stop There
&lt;/h2&gt;

&lt;p&gt;I still believe that after trying out multiple Neovim distributions, is to write your own. At this point, you know what exists, and what you like. You've seen examples of how everything is glued together. And you've graduated from Beginner Academy. A super easy way to start would be to use &lt;a href="https://github.com/nvim-lua/kickstart.nvim"&gt;Kickstart.nvim&lt;/a&gt;. This configuration is very minimal and all contained within one file, meant for a launchpad for your own configuration.&lt;/p&gt;

&lt;p&gt;I don't think that sticking with one distribution forever is the best idea. You get used to another person's particular setup and feel, which may not reside completely with you. When you write your own, you get an even deeper understanding of your editor and how it all works. When something goes awry (and things are bound to do so, what do you think this kind of work is about?), you can figure out pretty quickly how to resolve it since you built it. &lt;/p&gt;

&lt;p&gt;This is my opinion, I am not responsible if your feelings were wounded throughout this read.&lt;/p&gt;

</description>
      <category>vim</category>
      <category>beginners</category>
      <category>neovim</category>
    </item>
  </channel>
</rss>
