<?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: doniyor2109</title>
    <description>The latest articles on DEV Community by doniyor2109 (@doniyor2109).</description>
    <link>https://dev.to/doniyor2109</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%2F51450%2F34467a72-5ab4-4041-9f6e-68d1d4eaf020.jpg</url>
      <title>DEV Community: doniyor2109</title>
      <link>https://dev.to/doniyor2109</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/doniyor2109"/>
    <language>en</language>
    <item>
      <title>New redux-lightweight library to help reduce redux boilerplate </title>
      <dc:creator>doniyor2109</dc:creator>
      <pubDate>Thu, 20 Dec 2018 06:13:11 +0000</pubDate>
      <link>https://dev.to/doniyor2109/new-redux-lightweight-library-to-help-reduce-redux-boilerplate--4gd5</link>
      <guid>https://dev.to/doniyor2109/new-redux-lightweight-library-to-help-reduce-redux-boilerplate--4gd5</guid>
      <description>&lt;p&gt;It is always our job to write actions, action types and reducers to work with redux. However they serve for one thing and they should not be spread. redux-lightweight library allows you to write your reducers, actions and action types in one class.&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;class&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt; &lt;span class="p"&gt;{&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;number&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="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;amount&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="k"&gt;this&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="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;amount&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;As you see all redux stuff is inside one class.&lt;/p&gt;

&lt;p&gt;Hope, it will help you with working redux easier.&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/doniyor2109" rel="noopener noreferrer"&gt;
        doniyor2109
      &lt;/a&gt; / &lt;a href="https://github.com/doniyor2109/redux-lightweight" rel="noopener noreferrer"&gt;
        redux-lightweight
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Write one business logic instead of writing actions, action types and reducers
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;redux-lightweight&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;This library generates actions creators, action types and reducers for you. It uses class as a syntactic sugar for generating actions and reducers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/redux-lightweight" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/4185f28a4c8a66a0bb1a51004241aa4dd5a3ad39f3ec873939868ba993e94758/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f72656475782d6c696768747765696768742e737667" alt=""&gt;&lt;/a&gt;
&lt;a href="https://travis-ci.com/doniyor2109/redux-lightweight" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/062ffc35ea7349171ffae4abbdb71a0f64f0c95661b38c37a128325a23d04d35/68747470733a2f2f7472617669732d63692e636f6d2f646f6e69796f72323130392f72656475782d6c696768747765696768742e7376673f6272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;
&lt;a href="https://codecov.io/gh/doniyor2109/redux-lightweight" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/a38c2050c300cd974e6d31038cfb33a67095a0867c86b65fd9a37838fd3be50f/68747470733a2f2f636f6465636f762e696f2f67682f646f6e69796f72323130392f72656475782d6c696768747765696768742f6272616e63682f6d61737465722f67726170682f62616467652e737667" alt="codecov"&gt;&lt;/a&gt;
&lt;a href="http://makeapullrequest.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/d88d8d77fa79e828eea397f75a1ebd114d13488aeec4747477ffbd2274de95ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e737667" alt="PRs Welcome"&gt;&lt;/a&gt;
&lt;a href="https://github.com/doniyor2109/redux-lightweight/blob/master/LICENSE" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/e581ac49b7e1e99fb951242be63f6fdc6ebbc20c89a97fca0de99e1f2e6ae87e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667" alt="GitHub"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/doniyor2109/status/1075425404100468736" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/4f677ce944dfdeb7a8cd741560d35d006363ef6160adeb63ee3d8c73373b1f51/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Table of Contents&lt;/h3&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/doniyor2109/redux-lightweight#introduction" rel="noopener noreferrer"&gt;Introduction&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#motivation" rel="noopener noreferrer"&gt;Motivation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/doniyor2109/redux-lightweight#getting-started" rel="noopener noreferrer"&gt;Getting Started&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#installation" rel="noopener noreferrer"&gt;Installation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/doniyor2109/redux-lightweight#usage" rel="noopener noreferrer"&gt;Usage&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#usage-with-react-hooks" rel="noopener noreferrer"&gt;Usage with React Hooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#usage-with-react-redux" rel="noopener noreferrer"&gt;Usage with react-redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#usage-with-redux-saga" rel="noopener noreferrer"&gt;Usage with redux-saga&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#usage-only-for-actions" rel="noopener noreferrer"&gt;Usage only for actions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#advanced-usage" rel="noopener noreferrer"&gt;Advanced Usage&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#how-it-works" rel="noopener noreferrer"&gt;How it works&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/doniyor2109/redux-lightweight#api-reference" rel="noopener noreferrer"&gt;API Reference&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#createupdaterupdater" rel="noopener noreferrer"&gt;createUpdater(Updater)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#useupdaterupdater" rel="noopener noreferrer"&gt;useUpdater(Updater)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/doniyor2109/redux-lightweight#licence" rel="noopener noreferrer"&gt;Licence&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Introduction&lt;/h1&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Motivation&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Redux is great library which solves data management. However it introduces some boilerplate. In order to add one business logic, developer must create 3 different things (action type, action creator, reducer) and they do one thing together. That is why I have decide to create utility that allows declare them in one place.
One business logic should be declared in one place.&lt;/p&gt;
&lt;p&gt;This library is inspired by &lt;a href="https://github.com/redux-utilities/redux-actions" rel="noopener noreferrer"&gt;redux-actions&lt;/a&gt; and &lt;a href="https://mobx.js.org/" rel="nofollow noopener noreferrer"&gt;mobx&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Getting Started&lt;/h1&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;$ npm install --save redux-lightweight&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;$ yarn add redux-lightweight&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Create class that has &lt;code&gt;state&lt;/code&gt; property as…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/doniyor2109/redux-lightweight" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>react</category>
      <category>redux</category>
      <category>actions</category>
      <category>reducer</category>
    </item>
  </channel>
</rss>
