<?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: Patrik Mäsiar</title>
    <description>The latest articles on DEV Community by Patrik Mäsiar (@patrik_masiar).</description>
    <link>https://dev.to/patrik_masiar</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%2F210748%2F614842ab-6f3b-4f1f-8167-2e558bc7a458.jpeg</url>
      <title>DEV Community: Patrik Mäsiar</title>
      <link>https://dev.to/patrik_masiar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/patrik_masiar"/>
    <language>en</language>
    <item>
      <title>react-keyboard-key NPM package</title>
      <dc:creator>Patrik Mäsiar</dc:creator>
      <pubDate>Sun, 14 Mar 2021 13:53:12 +0000</pubDate>
      <link>https://dev.to/patrik_masiar/react-keyboard-key-npm-package-530i</link>
      <guid>https://dev.to/patrik_masiar/react-keyboard-key-npm-package-530i</guid>
      <description>&lt;p&gt;I created an NPM package mostly for developers, who are working with ReactJS.&lt;/p&gt;

&lt;p&gt;The package includes Container with &lt;code&gt;keydown&lt;/code&gt; and &lt;code&gt;keyup&lt;/code&gt; events. The container is handling the state of pressed key information and pushes it further.&lt;/p&gt;

&lt;p&gt;There is also created hook called &lt;code&gt;useKeyboardKey&lt;/code&gt; which is a substitute for Container so you can use it across the whole application wherever you want, you will just use the hook function.&lt;/p&gt;

&lt;p&gt;Package link: &lt;a href="https://www.npmjs.com/package/react-keyboard-key"&gt;react-keyboard-key&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>npm</category>
      <category>package</category>
    </item>
    <item>
      <title>What key did I press?</title>
      <dc:creator>Patrik Mäsiar</dc:creator>
      <pubDate>Fri, 12 Mar 2021 14:30:05 +0000</pubDate>
      <link>https://dev.to/patrik_masiar/what-key-did-i-press-2jfk</link>
      <guid>https://dev.to/patrik_masiar/what-key-did-i-press-2jfk</guid>
      <description>&lt;p&gt;I was just listening podcast about keyboard event listeners and I got an idea.&lt;/p&gt;

&lt;p&gt;I was thinking about a mini web application that tells developers, what key did they press. I do not mean character on the keyboard. I mean, what that key did. What is hidden in the keys?&lt;/p&gt;

&lt;p&gt;If you need some information about the key values or key codes, you need to listen to them. You need to listen to the keyboard. There are &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event"&gt;keyboard listeners in Javascript&lt;/a&gt; you can use.&lt;/p&gt;

&lt;p&gt;This application is listening to keyboard events and I am handling event values and setting to state. I am using Container from &lt;a href="https://www.npmjs.com/package/react-keyboard-key"&gt;react-keyboard-key&lt;/a&gt; package. There is also an option to use hooks. In the Container, there are maintained values and they are presenting to the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Application: &lt;a href="https://whatdidipress.com/"&gt;whatdidipress.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Github project: &lt;a href="https://github.com/massoprod/what-did-i-press"&gt;Github&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Package: &lt;a href="https://www.npmjs.com/package/react-keyboard-key"&gt;react-keyboard-key&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Support
&lt;/h1&gt;

&lt;p&gt;If you liked my article, application, or project, you can support me by sharing it into the world 🌎. Thank you ♥️&lt;/p&gt;

</description>
      <category>react</category>
      <category>eventlisteners</category>
      <category>nextjs</category>
      <category>console</category>
    </item>
    <item>
      <title>Learn algorithms</title>
      <dc:creator>Patrik Mäsiar</dc:creator>
      <pubDate>Wed, 16 Sep 2020 05:44:43 +0000</pubDate>
      <link>https://dev.to/patrik_masiar/learn-algorithms-3i64</link>
      <guid>https://dev.to/patrik_masiar/learn-algorithms-3i64</guid>
      <description>&lt;p&gt;Let me introduced you "Algorythms of the night".&lt;br&gt;
The repo with a list of awesome algorithms that help you to solve your code issues or can help you in interviews if you are looking for a new job.&lt;/p&gt;

&lt;p&gt;This repo is fully educational. It serves for education or practice.&lt;/p&gt;

&lt;p&gt;Feel free to contribute.&lt;/p&gt;

&lt;p&gt;By the way, you can follow Instagram account instagram.com/awesome_algorithm/&lt;/p&gt;

&lt;p&gt;Repo: github.com/massoprod/algorythm-of-the-night&lt;/p&gt;

</description>
      <category>java</category>
      <category>algorightms</category>
      <category>logic</category>
      <category>programming</category>
    </item>
    <item>
      <title>Bitly field for ReactJS</title>
      <dc:creator>Patrik Mäsiar</dc:creator>
      <pubDate>Tue, 08 Sep 2020 17:35:10 +0000</pubDate>
      <link>https://dev.to/patrik_masiar/bitly-field-for-reactjs-4hai</link>
      <guid>https://dev.to/patrik_masiar/bitly-field-for-reactjs-4hai</guid>
      <description>&lt;p&gt;A few times ago, I did a new NPM package which is related to Bitly. I did a form field that returns you a shorter link by Bitly.&lt;/p&gt;

&lt;p&gt;You can try and download it here: &lt;a href="https://github.com/massoprod/bitly-field-react"&gt;https://github.com/massoprod/bitly-field-react&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>npm</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Package: react-style-classes</title>
      <dc:creator>Patrik Mäsiar</dc:creator>
      <pubDate>Fri, 03 Jan 2020 13:30:41 +0000</pubDate>
      <link>https://dev.to/patrik_masiar/package-react-style-classes-1imf</link>
      <guid>https://dev.to/patrik_masiar/package-react-style-classes-1imf</guid>
      <description>&lt;p&gt;Every one of us knows the case when you need to add more class names to style your component depending on some conditions, but you do not want to have negative boolean values in className prop.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://www.kontentino.com/?home"&gt;Kontentino&lt;/a&gt;, we had the same issue.&lt;/p&gt;

&lt;p&gt;So, what are you going to do if you need to solve a problem like this?&lt;br&gt;
Probably, the first option that are you going to do is find the library which will help you.&lt;br&gt;
Another option is to write your own library. This is what we did and also what we do! We develop our own libraries.&lt;/p&gt;

&lt;p&gt;We wanted to solve the issue, that if we have class names depending on the condition of state like:&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="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;isModalShown&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;};&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;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{[&lt;/span&gt;&lt;span class="o"&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isModalShown&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;item&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isModalShown&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;activeItem&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result of this example is &lt;code&gt;["item", false]&lt;/code&gt;. It is something that you do not want to have in className prop. So we needed to remove boolean values if it equals false, and put class name if the condition applies.&lt;/p&gt;

&lt;p&gt;We coded our own package!&lt;/p&gt;

&lt;p&gt;One of our first libraries is named &lt;a href="https://github.com/kontentino/react-style-classes"&gt;react-style-classes&lt;/a&gt; and this library solves the problem with boolean values in an array of styles. It is a package for merge arguments of component style class names.&lt;/p&gt;

&lt;p&gt;If you are interested in how we wrote this helper, you can join us on Github. &lt;a href="https://github.com/kontentino/react-style-classes"&gt;https://github.com/kontentino/react-style-classes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More interesting articles coming soon at &lt;a href="https://kontentino.engineering/"&gt;kontentino.engineering&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kontentino</category>
      <category>package</category>
      <category>library</category>
      <category>classes</category>
    </item>
    <item>
      <title>My first real-time chat application</title>
      <dc:creator>Patrik Mäsiar</dc:creator>
      <pubDate>Mon, 14 Oct 2019 19:30:04 +0000</pubDate>
      <link>https://dev.to/patrik_masiar/my-first-real-time-chat-application-3851</link>
      <guid>https://dev.to/patrik_masiar/my-first-real-time-chat-application-3851</guid>
      <description>&lt;p&gt;A few days ago, I started to think about the real-time application. In our company, we started to use &lt;a href="https://pusher.com/" rel="noopener noreferrer"&gt;Pusher&lt;/a&gt; for real-time notifications receiving and I thought, that I should try it to have a piece of knowledge about how it works.&lt;/p&gt;

&lt;p&gt;I was thinking about the application subject, and I came to the conclusion, that the best real-time application example will be the application, where two separated users will see interactions of each other.&lt;/p&gt;

&lt;h1&gt;
  
  
  Choosing a technology
&lt;/h1&gt;

&lt;p&gt;For my app, I chose NodeJS together with &lt;a href="https://pusher.com/" rel="noopener noreferrer"&gt;Pusher&lt;/a&gt; for the server-side part. &lt;a href="https://pusher.com/" rel="noopener noreferrer"&gt;Pusher&lt;/a&gt; also offers few products for developing back-end, like a &lt;a href="https://pusher.com/chatkit" rel="noopener noreferrer"&gt;ChatKIT&lt;/a&gt;, which is the platform to build in-app chat with nice and user-friendly interface.&lt;br&gt;
For the client-side part, I chose to React, which is the Javascript framework.&lt;/p&gt;
&lt;h1&gt;
  
  
  Part 1. - server
&lt;/h1&gt;

&lt;p&gt;For the server, I created a separated folder, with the necessary packages installed.&lt;/p&gt;

&lt;p&gt;My server folder contains only three files: &lt;em&gt;.env&lt;/em&gt;, &lt;em&gt;package.json&lt;/em&gt; and &lt;em&gt;server.js&lt;/em&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Writing a code
&lt;/h3&gt;

&lt;p&gt;I used to help myself with &lt;a href="https://pusher.com/tutorials/customer-service-chat-react" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt; by &lt;a href="https://pusher.com/" rel="noopener noreferrer"&gt;Pusher&lt;/a&gt; with very few changes. I put some code in there, which served on the GET request to pull all rooms from the database based on a specific user ID.&lt;/p&gt;

&lt;p&gt;The reason was, that I needed to load all chatrooms in one request. In &lt;a href="https://pusher.com/chatkit" rel="noopener noreferrer"&gt;ChatKIT&lt;/a&gt; console, I had to create one user included in all chatrooms. His ID was used in a request to get a list of all created rooms at a client-side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Added part of code in server.js:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/posts&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="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nx"&gt;chatkit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUserRooms&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userId&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&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="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&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;h1&gt;
  
  
  Part 2. - client
&lt;/h1&gt;

&lt;p&gt;I do not need to explain how to do a ReactJs application. All the time, I was focused on the proper division of components.&lt;/p&gt;

&lt;p&gt;This is not a large application. I decided to create one folder called  &lt;em&gt;components&lt;/em&gt;, where I have all UI controllers and elements. The second one is a folder named &lt;em&gt;store&lt;/em&gt;. This folder is more important. I saved in there data at the highest level of application. I used &lt;a href="https://reactjs.org/docs/context.html" rel="noopener noreferrer"&gt;React context API&lt;/a&gt; to have my own state management.&lt;/p&gt;

&lt;p&gt;With this global state, I can manipulate application data from any part of the code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store.js:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createContext&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="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&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;AppContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createContext&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;room&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="na"&gt;setRoom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppProvider&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;setUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nx"&gt;setRoom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;room&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;room&lt;/span&gt; &lt;span class="p"&gt;})&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;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;room&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;setUser&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;setUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;setRoom&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;setRoom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nf"&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AppContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&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;state&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="si"&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;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;AppContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;&lt;span class="p"&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AppConsumer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;AppContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Consumer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I wrapped the main application component to created a store, or state, provider.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;index.js:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AppProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;AppProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Deploying
&lt;/h1&gt;

&lt;p&gt;Also, for the first time, I tried to use &lt;a href="https://github.com/tschaub/gh-pages" rel="noopener noreferrer"&gt;GitHub pages&lt;/a&gt; to publish my application in a few minutes. I was surprised at how fast and easy you are able to release application or web.&lt;/p&gt;

&lt;p&gt;For the node server deploying, I can recommend &lt;a href="https://www.heroku.com/" rel="noopener noreferrer"&gt;Heroku&lt;/a&gt; as an available tool to testing your solutions for free.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fp5stboiub9egeibn8vnr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fp5stboiub9egeibn8vnr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;That right - my application has not the most beautiful code syntax, refactored code or partitioning folders. But I wanted to know, that making of real-time application is not so difficult process as it seems to be like.&lt;/p&gt;

&lt;p&gt;I was able to create a working real-time application within the possibilities with the minimum of used thirty part libraries and without unnecessary code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DEMO:&lt;/strong&gt; &lt;a href="https://massoprod.github.io/mini-chat-app/" rel="noopener noreferrer"&gt;massoprod.github.io/mini-chat-app/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;CODE:&lt;/strong&gt; &lt;a href="https://github.com/massoprod/mini-chat-app" rel="noopener noreferrer"&gt;github.com/massoprod/mini-chat-app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>pusher</category>
      <category>react</category>
      <category>node</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
