<?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: Inbal Sinai</title>
    <description>The latest articles on DEV Community by Inbal Sinai (@theblushingcrow).</description>
    <link>https://dev.to/theblushingcrow</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%2F170006%2F2f016d0f-81f9-47e0-9a80-100d86b4017c.jpeg</url>
      <title>DEV Community: Inbal Sinai</title>
      <link>https://dev.to/theblushingcrow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/theblushingcrow"/>
    <language>en</language>
    <item>
      <title>Supercharge Your Svelte State Management with Akita</title>
      <dc:creator>Inbal Sinai</dc:creator>
      <pubDate>Wed, 03 Jul 2019 11:11:55 +0000</pubDate>
      <link>https://dev.to/theblushingcrow/supercharge-your-svelte-state-management-with-akita-4leo</link>
      <guid>https://dev.to/theblushingcrow/supercharge-your-svelte-state-management-with-akita-4leo</guid>
      <description>&lt;p&gt;There’s a new player in the world of JS frameworks — Svelte. As its name suggests, Svelte is lean, extremely lean. In fact, Svelte’s modus operandi, of compiling code to (ideal) vanilla js during the build phase rather than interpreting it during the run phase, has had people describing it as a non-framework and its own creator &lt;a href="https://gist.github.com/Rich-Harris/0f910048478c2a6505d1c32185b61934" rel="noopener noreferrer"&gt;calling it a language&lt;/a&gt;, rather than a framework. Specifically, one created for describing reactive user interfaces.&lt;/p&gt;

&lt;p&gt;I’ve started playing around with Svelte and so far I’ve been having a blast. The &lt;a href="https://svelte.dev/tutorial" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt; offered by creator Rich Harris functions as a very pleasant introduction. After completing it, I started to wonder how &lt;a href="https://netbasal.com/introducing-akita-a-new-state-management-pattern-for-angular-applications-f2f0fab5a8" rel="noopener noreferrer"&gt;Akita&lt;/a&gt;, the state management solution we’ve created here in Datorama, would work in conjunction with Svelte.&lt;/p&gt;

&lt;h3&gt;
  
  
  Svelte + Akita = A Great Combo
&lt;/h3&gt;

&lt;p&gt;If you’re already familiar with Svelte, you might be asking yourself why additional state management is even required, as Svelte comes with built-in reactive store functionality. If you have a small application, you can probably get away with using Svelte API alone. However, larger and more complex applications require a full-fledged state management solution. It’s similar to how we need Redux when we have React’s Context API.&lt;/p&gt;

&lt;p&gt;A note on Akita’s architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vFgoQX5A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%252F-LDIcOEJiLYk8yWho34E%252F-LEFMbbD5BNkHxecdUde%252F-LEFMe1nMjDF-0kBdGY5%252Fakita-arc.jpg%3Falt%3Dmedia%26token%3D4f72cec7-063d-46f2-b231-48d475235744" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vFgoQX5A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%252F-LDIcOEJiLYk8yWho34E%252F-LEFMbbD5BNkHxecdUde%252F-LEFMe1nMjDF-0kBdGY5%252Fakita-arc.jpg%3Falt%3Dmedia%26token%3D4f72cec7-063d-46f2-b231-48d475235744" alt="Akita’s architecture" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The two main components of Akita are the store and the query. You can think of the store like a table that contains data in a database, and you can perform various actions on it like inserting, updating, etc. My svelte component will reactively get the data from the query. And since I want it to remain agnostic of its data source, I won’t import the store inside the component; Instead, I’ll create a service for the component to work with.&lt;/p&gt;

&lt;p&gt;As you can see, Akita defines a strict pattern for managing your state data. It comes with powerful Entity management, a robust set of plugins and dev-tools, and its own cli. Svelte and Akita are a great natural combo because Akita’s queries can return observables, which Svelte &lt;strong&gt;supports out of the box&lt;/strong&gt;. So here is one example of how the two can be used in tandem:&lt;/p&gt;

&lt;h3&gt;
  
  
  Incorporating Akita
&lt;/h3&gt;

&lt;p&gt;To add Akita to my svelte app, I install it, and its cli, via npm. I start with a fresh &lt;a href="https://github.com/antony/svelte-seed" rel="noopener noreferrer"&gt;Svelte seed&lt;/a&gt; and go ahead with creating the traditional “TODO” app using Svelte and Akita.&lt;/p&gt;

&lt;h3&gt;
  
  
  The TODO Entity Store
&lt;/h3&gt;

&lt;p&gt;Since we’re dealing with TODO items, I opt to create an Entity Store in Akita. You can think of an entity store as a table in a database where each row represents an entity. To do that I use the &lt;a href="https://github.com/datorama/akita/tree/master/cli" rel="noopener noreferrer"&gt;Akita CLI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The store itself has all the built-in methods I need in order to perform CRUD operations on my entities.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In addition to those methods, I add a filter parameter in the store creation, representing the &lt;a href="https://engineering.datorama.com/ui-state-management-made-easy-with-akita-and-angular-6e460566ec7c" rel="noopener noreferrer"&gt;UI State data&lt;/a&gt; used to filter the display of the TODO items.&lt;/p&gt;

&lt;h3&gt;
  
  
  The TODO Service
&lt;/h3&gt;

&lt;p&gt;Next, I’ll create the aforementioned service:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;It contains all the methods I’ll need to update/read from the server and the store.&lt;/p&gt;

&lt;h3&gt;
  
  
  The TODO Entity Query
&lt;/h3&gt;

&lt;p&gt;Akita Entity Query’s built-in methods can be divided into two types. A method that starts with select, for which you get an observable for the requested data, and methods that start with get, in which you get the requested data directly. It’s important to emphasize that the subscription won’t be triggered unless the value you asked is changed by reference. To those, I add the following methods:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;I use &lt;code&gt;combineLatest&lt;/code&gt; to subscribe to the store, get the latest version of the TODO list, and filter it according to the latest filter selection.&lt;/p&gt;

&lt;p&gt;The next step is to create the Svelte components that interact with the Akita Entity store:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Filter Component
&lt;/h3&gt;

&lt;p&gt;This component’s sole responsibility is to let the users determine the criteria by which they filter the TODO list:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  The Add TODO Component
&lt;/h3&gt;

&lt;p&gt;This component is in charge of dispatching a todo event for the purpose of adding a TODO:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  The TODO Component
&lt;/h3&gt;

&lt;p&gt;It is used to display a single TODO item, along with a button for deleting it, and a checkbox to toggle its ‘completed’ status:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Connecting the Dots
&lt;/h3&gt;

&lt;p&gt;Finally, a TODOs component will use all the previously mentioned components, along with the query and service I’ve created, to manage my list:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  The End Result
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F521a1u69om69rsods17n.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F521a1u69om69rsods17n.gif" width="1349" height="1067"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we conclude, I wanted to add one last tidbit: Another thing you can get from Akita out of the box, is the ability to persist the state via local storage. I simply add in the main JS file:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And voila, your state is now persistent!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fswfpw326djfe4j0yod60.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fswfpw326djfe4j0yod60.gif" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find all the files for this example &lt;a href="https://github.com/datorama/akita/tree/master/examples/svelte" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In summary: &lt;strong&gt;Both Akita and Svelte offer a moderate learning curve and enable the easy creation of incredibly lean apps with super-efficient state management out of the box. I encourage you to try both, either together or separately&lt;/strong&gt; 👯‍♀️&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Follow me on &lt;a href="https://medium.com/@inbalsinai" rel="noopener noreferrer"&gt;Medium&lt;/a&gt; to read more about Svelte, Akita, JS!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>akita</category>
    </item>
    <item>
      <title>Managing Your State Navigation Data is a Breeze Using Angular and Akita</title>
      <dc:creator>Inbal Sinai</dc:creator>
      <pubDate>Wed, 03 Jul 2019 08:41:30 +0000</pubDate>
      <link>https://dev.to/theblushingcrow/managing-your-state-navigation-data-is-a-breeze-using-angular-and-akita-1kg8</link>
      <guid>https://dev.to/theblushingcrow/managing-your-state-navigation-data-is-a-breeze-using-angular-and-akita-1kg8</guid>
      <description>&lt;p&gt;The &lt;a href="https://github.com/datorama/akita-ng-router-store"&gt;Akita ng-router-store&lt;/a&gt; is a neat package offered to Akita users, which enables binding the Angular router state to an Akita store. The benefits of this approach are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The router state is stored in an Akita store named router, which serves as the single source of truth for things such as URL, state data parameters, query parameters, etc.&lt;/li&gt;
&lt;li&gt;Our components don’t have to be familiar with the data source. The RouterQuery can be injected in any one of the queries to create an encapsulated derived selector.&lt;/li&gt;
&lt;li&gt;The library exposes Akita style queries, saving you from dealing with all the required boilerplate code.&lt;/li&gt;
&lt;li&gt;We can examine the current router state in the Redux devtools and perform ‘time-traveling’.
To get started, install the package and add it, as well as Akita’s devtools module, to the app module:&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;At this point you should see the router store in the Redux devtools, and you have at your disposal the following query API:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;For example, let’s say we want to query the current entity based on the URL &lt;code&gt;id&lt;/code&gt; parameter, we can do the following in our &lt;code&gt;ArticlesQuery&lt;/code&gt; class:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And use it in our component:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Voila — easy breezy navigation management!&lt;/p&gt;

&lt;p&gt;Last but not least: A new version of Akita just landed in Github! You can check out the breaking changes and the new features &lt;a href="https://github.com/datorama/akita/blob/master/BREAKING_CHANGES.md#400"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://medium.com/@inbalsinai"&gt;Medium&lt;/a&gt; to read more about Angular, Akita, JS!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>akita</category>
    </item>
    <item>
      <title>10  Reasons Why You Should Start Using Akita as Your State Management Solution</title>
      <dc:creator>Inbal Sinai</dc:creator>
      <pubDate>Tue, 21 May 2019 13:22:05 +0000</pubDate>
      <link>https://dev.to/theblushingcrow/10-reasons-why-you-should-start-using-akita-as-your-state-management-solution-c72</link>
      <guid>https://dev.to/theblushingcrow/10-reasons-why-you-should-start-using-akita-as-your-state-management-solution-c72</guid>
      <description>&lt;p&gt;State management is ubiquitous in web applications, be they big or small. One of the notable solutions in this field is Akita. Whether it's entities arriving from the server or UI state data, Akita has custom-built stores, powerful tools, and tailor-made plugins, which help you manage the data and negate the need for massive amounts of boilerplate code. Here are ten reasons why you should start using it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita is a veteran in the field:&lt;/strong&gt; It's been out for a year already and even before that it was used for over a year in Datorama, as part of a real-world app utilized by thousands of customers. The app includes elaborate state management, component communication, complex form handling, dirty checking, undo functionality, and rapid manipulation of big data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita has the backing of Datorama:&lt;/strong&gt; Akita doesn't rely on sponsors to continue evolving. It was created here, in Datorama, a Salesforce company. Datorama developers maintain it and improve it as part of our work schedule. Additionally, we often get inspiration for new Akita features from the needs of the continually growing and evolving Datorama app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita is easy to pick up:&lt;/strong&gt; It has a moderate learning curve, suitable for both experienced and inexperienced developers alike. It features  a robust set of tools, anything you might need for quickly deploying a quality app. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita isn't coupled with Angular:&lt;/strong&gt; Once you get the hang of using it, Akita can be used with &lt;a href="https://engineering.datorama.com/oop-and-rxjs-managing-state-in-react-with-akita-de981e09307"&gt;React&lt;/a&gt;, Vue, &lt;a href="https://github.com/datorama/akita/tree/master/examples/svelte"&gt;Svelte&lt;/a&gt;, Angular, or even vanilla JS. No framework-specific adapter is needed; This means that if you swap framework, changes to Akita code are kept to a minimum. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita  has a 0 bugs policy:&lt;/strong&gt; Here at Datorama, we consider your bugs as our bugs. Since Akita is deployed in our production environment, it's crucial for us to solve any bugs you might discover ASAP. The Akita repo issues section is a testament to that. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita is very well documented:&lt;/strong&gt; We understand the importance of thorough documentation, and do our best to supply Akita users with complete documentation of all necessary information. Additionally, we often write &lt;a href="https://netbasal.gitbook.io/akita/general/blog-posts"&gt;blog posts&lt;/a&gt; detailing the various ways in which Akita can be used in your apps. Like Akita itself, we constantly work on growing and improving this knowledge base.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita's community is growing, fast:&lt;/strong&gt; With over &lt;a href="https://npm-stat.com/charts.html?package=%40datorama%2Fakita"&gt;320,000 downloads&lt;/a&gt; to date, Akita is growing in popularity in lightning speed. Another sign of its ubiquity - familiarity with Akita has recently started showing up in Front-End position postings. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita is well-suited for full stack developers:&lt;/strong&gt; Akita is based on object-oriented design principles rather than functional programming, so developers with OOP experience should feel right at home. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita developers are easy to reach:&lt;/strong&gt; Akita has a dedicated Gitter channel which is staffed daily. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Akita has a full suite of accompanying plugins:&lt;/strong&gt; redo-undo, persist state, dirty check, pagination, devtools, router integration, CLI, and more. &lt;br&gt;
See something missing that you want to be added? We're very receptive to requests 🙂&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In summary: &lt;strong&gt;There are plenty of reasons to pick up Akita today. I highly recommend you give it a try - you'll discover it provides you with an efficient and easy to use solution for all your state management needs! To get started go to the &lt;a href="https://github.com/datorama/akita"&gt;Akita repo on github&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://medium.com/@inbalsinai"&gt;Medium&lt;/a&gt; to read more about Angular, Akita, JS!&lt;/p&gt;

</description>
      <category>akita</category>
      <category>angular</category>
      <category>react</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
