<?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>Forem: Lucas Besen</title>
    <description>The latest articles on Forem by Lucas Besen (@lucasbesen).</description>
    <link>https://forem.com/lucasbesen</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%2F222545%2F30941df2-c16a-43c4-86e1-b8df8299113d.jpg</url>
      <title>Forem: Lucas Besen</title>
      <link>https://forem.com/lucasbesen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/lucasbesen"/>
    <language>en</language>
    <item>
      <title>My life's architecture</title>
      <dc:creator>Lucas Besen</dc:creator>
      <pubDate>Thu, 03 Sep 2020 11:32:56 +0000</pubDate>
      <link>https://forem.com/lucasbesen/my-life-s-architecture-ieh</link>
      <guid>https://forem.com/lucasbesen/my-life-s-architecture-ieh</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Consistency &amp;gt; crazy volume of activity&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This post marks a new beginning in my life. All the content that you'll find here is based on my opinions. It could work for you or don't. What I recommend to you is to take a look at your life, create your own long-term goals. Check if your lifestyle could help you to achieve these goals. That said, let's begin.&lt;/p&gt;




&lt;p&gt;I'm a person that always wants more. I want to have a bigger salary, I want to learn more things, I want to work with great companies, I want to be better. And sometimes I want it fast. I needed to improve that. All these things are good to seek, but it should be healthy. I'm still working on my mind, to have the patience to achieve all my goals. Some people, including me, have the feeling that they don't know anything. They need to add more and more things to learn. But what works is consistency. Keep learning and working on yourself every single day. That's the main reason I've created my life's architecture. I have a place where I can search for things that could make me better when I need it. I can track my progress and this whole context helps me to control all the anxiety over the studies and work.&lt;/p&gt;

&lt;p&gt;Despite the pandemic, this year was chaotic for me. I was disappointed with my life organization. Everything in my life was chaotic, I felt unproductive, I needed a plan and take control over my life.&lt;/p&gt;

&lt;p&gt;Before thinking of studies and work, I needed to check my habits. I needed to think about me. How I could be better. If there was something I could improve. During some time, I checked all my habits and I wrote notes about them. After that, I checked one by one to see if I could complete my long-term goals sticking with those habits. Of course I couldn't. Then, I've created a flowchart to decide what I should stick and what I should drop.&lt;/p&gt;

&lt;p&gt;The idea of this flow chat was quite simple: make sure the habit would help me to achieve my goals. Check if some extraordinary people do that. T. Harv Eker teaches that in his book, &lt;em&gt;Secrets Of The Millionaire Mind&lt;/em&gt;: you can be successful by following the habits of successful people.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dsVTef27--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/d2y22ipkaxw84p1wh8d9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dsVTef27--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/d2y22ipkaxw84p1wh8d9.png" alt="A flowchart that helped me to decide to drop or stick with a habit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This flowchart illustrates how I designed my mind to drop or stick with a habit, it's not a rule. Of course I keep watching Netflix, for example. But instead of doing it for the whole night, I work on my side-projects, learn something new, read books and keep just a small piece of time to that.&lt;/p&gt;

&lt;p&gt;I believe that balance is the key, you must have hobbies. But to be successful you need to sacrifice a few things. It was not easy to leave the comfort zone. Sometimes I still want to go back. But my compromise with my goals is bigger than my will to watch Netflix. By the way, don't think I don't do anything else. I still have my hobbies and activities to relax.&lt;/p&gt;

&lt;p&gt;Being better is something we could achieve with consistency. We don't need to be a master in the next day. We don't need to embrace the world. We just need to create a plan and make sure every single day we'll be a step closer to achieve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Organization
&lt;/h2&gt;

&lt;p&gt;I've been trying to achieve organization in many ways, but as a perfectionist, it was not easy. I've tried to keep one app for each thing I would complete. But with Notion, I found the perfect solution for me. I can keep everything organized in one place. Another reason I've been using it is that you can use beautiful templates to achieve what you want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bKwa3TRt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9z8mkck5q7vfbwrcj66h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bKwa3TRt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9z8mkck5q7vfbwrcj66h.png" alt="My life architecture based on Notion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using Notion in the way above, I became a way more productive and focused. I know where to search for something. I can keep notes on everything. I can track my progress during every single thing.&lt;br&gt;
There are some sections I would like to share with you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Daily&lt;/li&gt;
&lt;li&gt;Life&lt;/li&gt;
&lt;li&gt;Studies&lt;/li&gt;
&lt;li&gt;Drafts&lt;/li&gt;
&lt;li&gt;Projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Daily&lt;/strong&gt;: I use this section for everything related to my day-by-day. I don't like unexpected events, so I try to have everything planned, even my schedules. Another thing I like is remote work. My day becomes more productive. I don't waste time with traffic. I can make my own schedule and sleep more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ey_c9NEx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dkk2y1f1qhwjwhop8yya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ey_c9NEx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dkk2y1f1qhwjwhop8yya.png" alt="My week schedule"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also use this section to keep my day-by-day ToDos and track my daily habits. I've been trying to stick with the habits below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Book reading&lt;/li&gt;
&lt;li&gt;Code something&lt;/li&gt;
&lt;li&gt;Exercise&lt;/li&gt;
&lt;li&gt;Writing&lt;/li&gt;
&lt;li&gt;Drink at least 1L of water&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Life&lt;/strong&gt;: this topic is the most personal. I track my short and long-term goals. I keep notes that help me to achieve them and insights I have during the process. My travel plans and all stuff related goes there too. Also, I like to make my own notes and task lists related to work in this place. I keep learnings, notes from meetings and projects ToDos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Studies&lt;/strong&gt;: this is by far my preferred section. I track all my progress and learnings here. This section contains everything I think it's necessary to be an extraordinary developer. English, hard-skills and soft-skills.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;English&lt;/strong&gt;: using English during my day helped me a lot. I've been working with people who have English as main language. It forced me to learn. But as a lifelong learner, I'm not satisfied. So I use mainly YouTube to learn and I keep my notes about it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hard-skills&lt;/strong&gt;: everything related with code. I track all the stuff I want to learn or master. Libraries, languages, learning processes, algorithms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Soft-skills&lt;/strong&gt;: to be a great developer, you need other skills. Leadership, sales, ownership. You need to be complete.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the books and articles I put on my list are related to the topics above. I like to improve my mind, so I also read books about depression and anxiety.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drafts&lt;/strong&gt;: this is pretty straight-forward. It's just notes about everything I want to write. When something comes to my mind, I go there and write. When I think it's good enough, I start to polish it. This is how I made this post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Projects&lt;/strong&gt;: all the projects I am working on or I want to work with. I use this section to keep notes and insights that could help me to develop the project. Also, every project has its project management inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As I said at the beginning of this post, it marks a new cycle in my life. I've committed to myself to improve every single day. Writing and learning in public were things I wanted to do for a long time. The process of designing my life's architecture helped me to learn a lot about myself and what works for me.&lt;/p&gt;

&lt;p&gt;If you have any thoughts to share with me, just ping me on &lt;a href="https://www.twitter.com/lucasbesen"&gt;Twitter&lt;/a&gt;. I tweet about everything we talked above.&lt;/p&gt;

&lt;p&gt;You can subscribe to my &lt;a href="https://lucasbesen.substack.com"&gt;newsletter&lt;/a&gt; to have early access to contents like this.&lt;/p&gt;

&lt;p&gt;I hope it can inspire you to learn and commit to yourself to be an extraordinary person.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>life</category>
      <category>habits</category>
    </item>
    <item>
      <title>Announcing React Kanban</title>
      <dc:creator>Lucas Besen</dc:creator>
      <pubDate>Mon, 09 Sep 2019 13:03:16 +0000</pubDate>
      <link>https://forem.com/lucasbesen/announcing-react-kanban-480e</link>
      <guid>https://forem.com/lucasbesen/announcing-react-kanban-480e</guid>
      <description>&lt;p&gt;Today, I'm excited to announce the first release of &lt;strong&gt;&lt;a href="https://github.com/lucasbesen/react-kanban-dnd"&gt;react-kanban-dnd&lt;/a&gt;&lt;/strong&gt;. React Kanban is a library that implements a kanban board (click &lt;a href="https://www.planview.com/resources/articles/what-is-kanban-board/"&gt;here&lt;/a&gt; if you don't know what it is) and it helps you to organize any kind of things in your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VEpWCtJv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9t1lvwiqq4emv28kw3dn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VEpWCtJv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9t1lvwiqq4emv28kw3dn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React Kanban idea comes from a project inside of &lt;strong&gt;&lt;a href="https://www.entria.com.br"&gt;Entria&lt;/a&gt;&lt;/strong&gt;. We needed something like GitHub's Project and we didn't find any project customizable enough.&lt;/p&gt;

&lt;p&gt;I created it over the &lt;strong&gt;&lt;a href="https://github.com/atlassian/react-beautiful-dnd"&gt;react-beautiful-dnd&lt;/a&gt;&lt;/strong&gt;, huge thanks to you guys, for providing this awesome DnD lib.&lt;/p&gt;

&lt;p&gt;One of the most things I've learned with this project is if you've done something cool on your company, talk with your teammates and make it open source. You will be helping the community, improving and polishing the code for your company.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YW1aRwc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6b0xqmcozaai1a8l0w3w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YW1aRwc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6b0xqmcozaai1a8l0w3w.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and Usage
&lt;/h2&gt;

&lt;p&gt;First, you need to install &lt;strong&gt;react-kanban-dnd&lt;/strong&gt; on your project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add react-kanban-dnd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, we're good to go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactKanban&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-kanban-dnd&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;MyKanban&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;render&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="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ReactKanban&lt;/span&gt;
        &lt;span class="nx"&gt;onDragEnd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&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;onDragEnd&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;onDragStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&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;onDragStart&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;renderCard&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&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;renderCard&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;columnStyle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;columnStyle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;columnHeaderStyle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;columnHeaderStyle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;columnTitleStyle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;columnTitleStyle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;cardWrapperStyle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cardWrapperStyle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&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;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;You can find &lt;strong&gt;react-kanban-dnd&lt;/strong&gt; and the docs &lt;a href="https://github.com/lucasbesen/react-kanban-dnd"&gt;here&lt;/a&gt;. Every kind of contribution is very welcome: issues, pull requests, feature requests. You can ping me at &lt;a href="https://www.twitter.com/lucasbesen"&gt;Twitter&lt;/a&gt; as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future
&lt;/h2&gt;

&lt;p&gt;Our roadmap is under development, but we have some items already:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move to Lerna&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Beside that, &lt;strong&gt;react-kanban-dnd&lt;/strong&gt; was developed to work with GraphQL. So, one of the next steps is the possibility of Relay Modern integration.&lt;/p&gt;

&lt;p&gt;I hope you enjoy it. Any feedback comment here or open an issue.&lt;/p&gt;

</description>
      <category>react</category>
      <category>relay</category>
      <category>productivity</category>
      <category>agile</category>
    </item>
    <item>
      <title>Relay Modern — Optimistic Update</title>
      <dc:creator>Lucas Besen</dc:creator>
      <pubDate>Mon, 09 Sep 2019 12:49:53 +0000</pubDate>
      <link>https://forem.com/lucasbesen/relay-modern-optimistic-update-2lh1</link>
      <guid>https://forem.com/lucasbesen/relay-modern-optimistic-update-2lh1</guid>
      <description>&lt;p&gt;Relay Modern provides an update way that solves the delay to update client data from server response.&lt;/p&gt;

&lt;p&gt;It consists in update the client data with an anticipated value that reflects server response.&lt;/p&gt;

&lt;p&gt;I'll describe in this post one way to update client data using &lt;strong&gt;optimisticResponse&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens if something goes wrong?
&lt;/h2&gt;

&lt;p&gt;In case server side returns an error, the client data will get a rollback.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens if server response was different from updated data?
&lt;/h2&gt;

&lt;p&gt;If the server response was different from updated data, Relay will apply server data ensuring consistency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Without Optimistic
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3oAVB5ee--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0jg23z41yp8t93tf7fdh.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3oAVB5ee--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0jg23z41yp8t93tf7fdh.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  With Optimistic
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oohyE4ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0bpwbe3q2agcz4jn1qo0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oohyE4ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0bpwbe3q2agcz4jn1qo0.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;optimisticResponse&lt;/strong&gt; is an object that reflect your mutation output and needs to be passed to &lt;strong&gt;commitMutation&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;commitMutation&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="s1"&gt;react-relay&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// mutation&lt;/span&gt;
&lt;span class="c1"&gt;// variables&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;optimisticResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;mutationName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&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;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;commitMutation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;mutation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;optimisticResponse&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;variables&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;Let's see a complete example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;commitMutation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;graphql&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="s1"&gt;react-relay&lt;/span&gt;&lt;span class="dl"&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;mutation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
  mutation ReadMessageMutation($input: ReadMessageMutationInput!) {
    ReadMessage(input: $input) {
      message {
    status
      }
    }
  }
`&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;optimisticResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;ReadMessage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;READ&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="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;commitMutation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;mutation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;optimisticResponse&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;variables&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;In the code above, I'm updating the message status before it returns from server side.&lt;/p&gt;

&lt;p&gt;I've made a repository to benchmark updating data with and without optimistic update.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ltO1CwHj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/obwud4j6e9p2yh2dskzf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ltO1CwHj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/obwud4j6e9p2yh2dskzf.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code and instructions can be found &lt;a href="https://github.com/lucasbesen/relay-modern-optimistic-update"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I hope you enjoy it, thanks for your time.&lt;/p&gt;

&lt;p&gt;Any troubles or doubts, send me a message. You can find me at &lt;a href="https://github.com/lucasbesen"&gt;Github&lt;/a&gt; and &lt;a href="https://www.twitter.com/lucasbesen"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>relay</category>
      <category>graphql</category>
    </item>
  </channel>
</rss>
