<?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: Christian Nascimento</title>
    <description>The latest articles on DEV Community by Christian Nascimento (@cbfn).</description>
    <link>https://dev.to/cbfn</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%2F279545%2F43126326-ccfe-41b1-a688-dbf87724e97f.jpeg</url>
      <title>DEV Community: Christian Nascimento</title>
      <link>https://dev.to/cbfn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cbfn"/>
    <language>en</language>
    <item>
      <title>State management with MobX and React</title>
      <dc:creator>Christian Nascimento</dc:creator>
      <pubDate>Fri, 22 May 2020 21:30:09 +0000</pubDate>
      <link>https://dev.to/cbfn/state-management-with-mobx-and-react-4l05</link>
      <guid>https://dev.to/cbfn/state-management-with-mobx-and-react-4l05</guid>
      <description>&lt;p&gt;One of the good things I find on Linkedin is the sharing of ideas, projects, and learning by many devs. I miss transmitting my knowledge more simply and directly. So, I took the time to pass on some of my knowledge. There will be more short articles with examples.&lt;/p&gt;

&lt;p&gt;I'll start by sharing a little bit about MobX.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is MobX?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://mobx.js.org"&gt;MobX&lt;/a&gt; is a library for state management just like Redux, which means that we can use it to either manage local or global states using Provider for example.&lt;/p&gt;

&lt;p&gt;Roughly speaking, MobX is based on observables, actions, and reactions. That is, every action performed generates a reaction, which seeks an observable and then updates it.&lt;/p&gt;

&lt;p&gt;Remember that it is not only exclusive for use with React, but there are also versions for other types of technology, for example Flutter.&lt;/p&gt;

&lt;p&gt;At the end of this article I leave a link to a small example, created in CodeSandbox, of an implementation using MobX with React.&lt;/p&gt;

&lt;h2&gt;
  
  
  A brief explanation for the stores.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Actions: When we want to update a state;&lt;/li&gt;
&lt;li&gt;Observables: Any element here is notified when it has some kind of reaction to a state.&lt;/li&gt;
&lt;li&gt;Computed: When we want to return a calculation, type excel formulas.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The example
&lt;/h2&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/mobx-with-react-k1htp"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://mobx.js.org"&gt;MobX&lt;/a&gt;&lt;br&gt;
&lt;a href="https://mobx-react.js.org"&gt;Mobx With React&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope it helps those who want to find a simpler alternative to be implemented than Redux.&lt;/p&gt;

&lt;p&gt;Cheers ;-)&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
