<?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: IniZio</title>
    <description>The latest articles on DEV Community by IniZio (@inizio).</description>
    <link>https://dev.to/inizio</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%2F92954%2F39455991-4fad-4746-b08d-135ba717183b.png</url>
      <title>DEV Community: IniZio</title>
      <link>https://dev.to/inizio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/inizio"/>
    <language>en</language>
    <item>
      <title>Iniz: Makes ReactJS actually reactive</title>
      <dc:creator>IniZio</dc:creator>
      <pubDate>Tue, 08 Nov 2022 11:14:24 +0000</pubDate>
      <link>https://dev.to/inizio/iniz-makes-reactjs-actually-reactive-305n</link>
      <guid>https://dev.to/inizio/iniz-makes-reactjs-actually-reactive-305n</guid>
      <description>&lt;p&gt;&lt;a href="https://iniz.netlify.app/"&gt;Iniz&lt;/a&gt; is a state library that brings reactivity to ReactJS.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/broken-rgb-24ezu5?module=%2FApp.tsx"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;ReactJS is a view library that uses "Push" strategy to detect changes and apply to actual DOM.&lt;/p&gt;

&lt;p&gt;For developers to "push" state through components, different patterns such as HOC, render-props, Context are introduced.&lt;br&gt;
These top-down approaches all have different drawbacks such as extra re-renders and "Provider Hell".&lt;/p&gt;

&lt;p&gt;Iniz takes a different approach by treating ReactJS "Component"" as "Effect" and variable update as "Exception" in FP.&lt;/p&gt;

&lt;p&gt;When a ReactJS "Component" is first rendered, Iniz collects its dependencies automatically and trigger re-render when the dependencies are updated.&lt;/p&gt;
&lt;h2&gt;
  
  
  Primitives
&lt;/h2&gt;

&lt;p&gt;Iniz provides a few primitives to describe state: &lt;code&gt;atom&lt;/code&gt;/&lt;code&gt;state&lt;/code&gt;, &lt;code&gt;effect&lt;/code&gt; and &lt;code&gt;computed&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  atom
&lt;/h3&gt;

&lt;p&gt;To create a state, call &lt;code&gt;atom()&lt;/code&gt; with first argument as initial value.&lt;/p&gt;

&lt;p&gt;If you use TypeScript, Iniz already infers the inital value as type. You can optionally pass in a type as generic.&lt;/p&gt;

&lt;p&gt;You can then call an "Atom" as function to get it's value. To update it, simply pass the value in the function call.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/mystifying-mclean-tdiblu"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  effect
&lt;/h3&gt;

&lt;p&gt;After an &lt;code&gt;atom&lt;/code&gt; is declared, it's value can be tracked with an &lt;code&gt;effect&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;effect()&lt;/code&gt; accepts function as argument and executes it once immediately.&lt;/p&gt;

&lt;p&gt;During execution, it collects all &lt;code&gt;atom&lt;/code&gt;'s used, and triggers again whenever the &lt;code&gt;atom&lt;/code&gt;'s are updated.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/great-elion-e5ffrj"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  computed
&lt;/h3&gt;

&lt;p&gt;You can also combine atoms to become a &lt;code&gt;computed&lt;/code&gt; value.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;computed&lt;/code&gt; accepts a function as well. But unlike &lt;code&gt;effect&lt;/code&gt;, it returns an &lt;code&gt;atom&lt;/code&gt; with computed value.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/naughty-sunset-icuehg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  React
&lt;/h2&gt;

&lt;p&gt;To use Iniz primitives in ReactJS, simply replace &lt;code&gt;@iniz/core&lt;/code&gt; with &lt;code&gt;@iniz/react&lt;/code&gt; and replace &lt;code&gt;effect&lt;/code&gt; with a component.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/twilight-paper-e1svs0?module=%2FApp.tsx"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Souce code is available on &lt;a href="https://github.com/IniZio/iniz"&gt;inizio/iniz&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Why Reim is not just another Redux</title>
      <dc:creator>IniZio</dc:creator>
      <pubDate>Fri, 17 Aug 2018 03:56:23 +0000</pubDate>
      <link>https://dev.to/inizio/why-reim-is-not-just-another-redux-3ga2</link>
      <guid>https://dev.to/inizio/why-reim-is-not-just-another-redux-3ga2</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/@newman.kcchow/why-reim-is-not-another-redux-17ff159ade55"&gt;https://medium.com/@newman.kcchow/why-reim-is-not-another-redux-17ff159ade55&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>immutable</category>
    </item>
  </channel>
</rss>
