<?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: Numbnut</title>
    <description>The latest articles on DEV Community by Numbnut (@daweet).</description>
    <link>https://dev.to/daweet</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%2F679368%2Fc26ef408-1a72-4316-9942-40a8333de8af.png</url>
      <title>DEV Community: Numbnut</title>
      <link>https://dev.to/daweet</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daweet"/>
    <language>en</language>
    <item>
      <title>YoffeeJS: Yet another Javascript framework. But this one's good, I think</title>
      <dc:creator>Numbnut</dc:creator>
      <pubDate>Tue, 03 Aug 2021 16:08:34 +0000</pubDate>
      <link>https://dev.to/daweet/yoffeejs-yet-another-javascript-framework-but-this-one-s-good-i-think-55il</link>
      <guid>https://dev.to/daweet/yoffeejs-yet-another-javascript-framework-but-this-one-s-good-i-think-55il</guid>
      <description>&lt;p&gt;As I strive to refine my stack, one consideration becomes increasingly important - &lt;strong&gt;Simplicity&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;I want my main tool - the UI library - to do just one thing: help me create reactive components. While doing so, it has to be unopinionated, as close to the standards as possible, without imposing anything except for the data reactivity bit.&lt;/p&gt;

&lt;p&gt;I didn't find anything that felt good enough, so I made one. Meet &lt;em&gt;YoffeeJS&lt;/em&gt;.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/lefetmeofefet" rel="noopener noreferrer"&gt;
        lefetmeofefet
      &lt;/a&gt; / &lt;a href="https://github.com/lefetmeofefet/yoffee" rel="noopener noreferrer"&gt;
        yoffee
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Minimal HTML one-way binding library
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Yoffee doesn't invent a new syntax. It doesn't impose a cumbersome API. No build steps. No Virtual DOM to slowly depress your soul. All you need to know is HTML and Javascript, and you're set to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hello World
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createYoffeeElement&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://unpkg.com/yoffee@latest/dist/yoffee.min.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="nf"&gt;createYoffeeElement&lt;/span&gt;&lt;span class="p"&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="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="s2"&gt;`&amp;lt;div&amp;gt;Hello World!&amp;lt;/div&amp;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;hello-world&amp;gt;&amp;lt;/hello-world&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try it on &lt;a href="https://jsfiddle.net/Numbnut/xmu902Lq/" rel="noopener noreferrer"&gt;JSFiddle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example we used the two API functions of Yoffee: &lt;code&gt;createYoffeeElement&lt;/code&gt; and &lt;code&gt;html&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;The output is a legit web component - a brand new HTML tag.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about data?
&lt;/h2&gt;

&lt;p&gt;Yoffee's features one-way data binding, much like React. Consider the counter button example:&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="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createYoffeeElement&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://unpkg.com/yoffee@latest/dist/yoffee.min.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

    &lt;span class="nf"&gt;createYoffeeElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;counter-button&lt;/span&gt;&lt;span class="dl"&gt;"&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;clicks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;`
            &amp;lt;button onclick=&lt;/span&gt;&lt;span class="p"&gt;${()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clicks&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;gt;
                I've been clicked &lt;/span&gt;&lt;span class="p"&gt;${()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clicks&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; times
            &amp;lt;/button&amp;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;counter-button&amp;gt;&amp;lt;/counter-button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try it on &lt;a href="https://jsfiddle.net/Numbnut/6c7ovnuk/13/" rel="noopener noreferrer"&gt;JSFiddle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When &lt;code&gt;state.clicks&lt;/code&gt; changes, Yoffee knows which expressions need to be rerun, and in turn which DOM Nodes need to be updated. No unnecessary expression evaluations, no DOM Diffing. You can read more about the mechanism and how it compares to other libraries in the &lt;a href="https://yoffee.netlify.app/" rel="noopener noreferrer"&gt;official docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about &lt;em&gt;everything else&lt;/em&gt;?
&lt;/h2&gt;

&lt;p&gt;Yoffee is just a thin wrapper for web components and reactive html. &lt;br&gt;
Things that usually require learning in other frameworks are elegant and obvious in Yoffee, like CSS, shared state, listening to events, passing data from component to component, calling callbacks passed from parent element, reacting to property changes, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  I use it and so should everybody
&lt;/h2&gt;

&lt;p&gt;Joking aside, some code style decisions were made, and I don't claim that they're objectively better. Some people may like the &lt;code&gt;useState&lt;/code&gt; syntax better.&lt;br&gt;
For me, this is the perfect framework. I use it in my projects.&lt;/p&gt;

&lt;p&gt;My wildest hope is that other people will like it, and use it, and maybe even contribute to it.&lt;/p&gt;

&lt;p&gt;In the future I plan to fill gaps that'll make it more accessible to everybody, like a components library and better documentation. &lt;/p&gt;

&lt;p&gt;Feel free to contact me, or add issues on &lt;a href="https://github.com/lefetmeofefet/yoffee" rel="noopener noreferrer"&gt;Github&lt;/a&gt; or magically dive into the code and open a PR. &lt;/p&gt;

&lt;p&gt;I'd love to collaborate!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>webcomponents</category>
    </item>
  </channel>
</rss>
