<?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: jan paul</title>
    <description>The latest articles on DEV Community by jan paul (@janpauldahlke).</description>
    <link>https://dev.to/janpauldahlke</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%2F30712%2Ff94df703-9006-4c9c-ae91-e29ef012d70d.jpeg</url>
      <title>DEV Community: jan paul</title>
      <link>https://dev.to/janpauldahlke</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/janpauldahlke"/>
    <language>en</language>
    <item>
      <title>thinking to myself when setting up a project boilerplate</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Tue, 04 May 2021 17:33:39 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/what-iam-thing-to-myself-when-setting-up-a-project-boilerplate-1p94</link>
      <guid>https://dev.to/janpauldahlke/what-iam-thing-to-myself-when-setting-up-a-project-boilerplate-1p94</guid>
      <description>&lt;p&gt;this is a &lt;strong&gt;thinking out loud&lt;/strong&gt; to myself.&lt;/p&gt;

&lt;h3&gt;
  
  
  how to prepare a SPA in different frameworks/libraries but also in angular
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;ng new&lt;/code&gt; &lt;code&gt;create-react-app&lt;/code&gt; &lt;code&gt;vue cli&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;enable router&lt;/li&gt;
&lt;li&gt;enable i18n strategy&lt;/li&gt;
&lt;li&gt;enable store / reduxy stuff&lt;/li&gt;
&lt;li&gt;bind router into store&lt;/li&gt;
&lt;li&gt;ensure your API with smthng &lt;a href="https://marketplace.visualstudio.com/items?itemName=humao.rest-client"&gt;like&lt;/a&gt;  or &lt;code&gt;curls&lt;/code&gt; / postmany stugff &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;test GET / POST/ UPDATE&lt;/li&gt;
&lt;li&gt;brief moment of think: do we need to auth? if so handle auth token with like setLocalStorage&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;create an entityfolder for selected endpoint, (if angular, also create a module here!!)&lt;/li&gt;
&lt;li&gt;create model/type declartion (only if typescript, which we prefer) of entities&lt;/li&gt;
&lt;li&gt;create service to consume any http-client (eg axios) // consider auth process
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;test GET / POST/ UPDATE &lt;code&gt;loadAll()&lt;/code&gt;, &lt;code&gt;oneOneById()&lt;/code&gt;, 
&lt;code&gt;postNew()&lt;/code&gt;, &lt;code&gt;update()&lt;/code&gt;, &lt;code&gt;delete()&lt;/code&gt; for selected entity&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;test servicemethods in bare minimum but routable component, most liekly in lifecycle method of given framework&lt;/li&gt;
&lt;li&gt;from now on we would need to distungiush from framework to framework/library which should be more articles, &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;in angular -which we atm work with- we go with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create routeresolvers&lt;/li&gt;
&lt;li&gt;prepare actions / reducer / selectors from ngrx, naivly bind http service into the loadaction (we like ngrx-entity here) &lt;/li&gt;
&lt;li&gt;access store in template and trigger action for udf to ensure actions work&lt;/li&gt;
&lt;li&gt;create effect for entity -&amp;gt; &lt;code&gt;loadAllEntity&lt;/code&gt; -&amp;gt; http-service -&amp;gt; dispatch &lt;code&gt;loadAllEntitySucess&lt;/code&gt;, bind result into store&lt;/li&gt;
&lt;li&gt;we forget about, register router, effect, store, store-router in module, considering it silently given from now on, knowing forRoot() and forFeature(). &lt;/li&gt;
&lt;li&gt;remove 3 from template&lt;/li&gt;
&lt;li&gt;consume loadEntity from action in routeresolver -&amp;gt; which should also will trigger the effect -&amp;gt; which will trigger the http -&amp;gt; which will trigger store binding&lt;/li&gt;
&lt;li&gt;bind observable/subscriber to store in template list view&lt;/li&gt;
&lt;li&gt;prepare route for single entity&lt;/li&gt;
&lt;li&gt;access route, write resolver that gains single entity from store / write actions..... from here on&lt;/li&gt;
&lt;li&gt;rinse repaet&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;quod erat demonstrandum.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>architecture</category>
      <category>javascript</category>
      <category>boilerplate</category>
    </item>
    <item>
      <title>looking for a good vpn provider</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Sat, 09 Jan 2021 16:14:05 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/looking-for-a-good-vpn-provider-2e53</link>
      <guid>https://dev.to/janpauldahlke/looking-for-a-good-vpn-provider-2e53</guid>
      <description>&lt;p&gt;I just asked this on the Typescript Discord Channel -- Offtopic, but tought why not enhance my question radius.&lt;/p&gt;

&lt;p&gt;[17:08] Paulquapper: could somone suggest my a VPN provider with &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1. a documented (javascripty) API and &lt;/li&gt;
&lt;li&gt;2. the feature torenew ip, for given city/country. Ideally non US, no US-Server provider.&lt;/li&gt;
&lt;li&gt;3. "cost efficient" (paying annualy)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>question</category>
      <category>vpn</category>
      <category>devops</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Need help to improve my usage of gatsby-image</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Thu, 19 Nov 2020 10:26:11 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/need-help-to-improve-my-usage-of-gatsby-image-mac</link>
      <guid>https://dev.to/janpauldahlke/need-help-to-improve-my-usage-of-gatsby-image-mac</guid>
      <description>&lt;p&gt;Hello fellow Gatsby'ers. Today i am comming with a question to you. I need to improve my bundle size, and therefore i want to rewrite my gatsby-image wrapper to be more efficient. &lt;/p&gt;

&lt;p&gt;Consider my bundle&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gd_fGVLt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sy22p5f5zxpobphoosxx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gd_fGVLt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sy22p5f5zxpobphoosxx.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;BUT: the 150 images itself are only 14MB in total, which means gatsby bloats it like crazy.&lt;/p&gt;

&lt;p&gt;I know my code smell in terms of BIG-O, but, my poor excuse, i didn't knew another way than mapping over the result. Can you guys help me to improve here, considering:&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;const&lt;/span&gt; &lt;span class="nx"&gt;ImageLarge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;props&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;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;StaticQuery&lt;/span&gt;
      &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
        query {
          allFile(filter: { sourceInstanceName: { eq: "assets" } }) {
            edges {
              node {
                relativePath
                name
                childImageSharp {
                  fluid(maxWidth: 600, quality: 100) {
                    ...GatsbyImageSharpFluid
                  }
                }
              }
            }
          }
        }
      `&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and here now my pile of shame:&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;const&lt;/span&gt; &lt;span class="nx"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allFile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;edges&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&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;return&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;relativePath&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&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;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Btw, my problem are comming from not beeing able to parametrize my static gqlquery with arguments, so i took all images, mapped over and returned only the image that i needed. horrible inifficnient. &lt;/p&gt;

&lt;p&gt;Why cant i do something like this?&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;const&lt;/span&gt; &lt;span class="nx"&gt;ImageLarge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;props&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;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;StaticQuery&lt;/span&gt;
      &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;`
        query {
          allFile(filter: { sourceInstanceName: { eq: `&lt;/span&gt;&lt;span class="nx"&gt;assets&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nx"&gt;png&lt;/span&gt;&lt;span class="s2"&gt;` } }) {
            edges {
              node {
                relativePath
                name
                childImageSharp {
                  fluid(maxWidth: 600, quality: 100) {
                    ...GatsbyImageSharpFluid
                  }
                }
              }
            }
          }
        }
      `&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I asked google and found this, which describes my problem perfectly, but offers no solution&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Believe it or not you cannot create a fully dynamic image component using a gastby-image without risking a (possibly very large) bloat in your bundle size. The problem is that static queries in Gatsby do not support string interpolation in it's template literal."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/57098239/what-is-the-best-way-to-display-all-pictures-of-a-directory-in-a-gatsby-project"&gt;what-is-the-best-way-to-display-all-pictures-of-a-directory-in-a-gatsby-project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If one you could help me to solve this problem, i'd be glad and i also think, that we should write about it here, so others can find this googeling.&lt;/p&gt;

&lt;p&gt;May the code be with you 🙏&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>react</category>
      <category>graphql</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Javascript Homeoffice Stream</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Thu, 12 Nov 2020 09:46:46 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/javascript-homeoffice-stream-5ajk</link>
      <guid>https://dev.to/janpauldahlke/javascript-homeoffice-stream-5ajk</guid>
      <description>&lt;p&gt;Hey fellow nerds,&lt;/p&gt;

&lt;p&gt;out of boredom in the homeOffice era, i started my very "unique" frontend stream. Feel free to join and chit chat.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.twitch.tv/paulquappe"&gt;https://www.twitch.tv/paulquappe&lt;/a&gt; :-)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to deal with real imposters?</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Thu, 12 Nov 2020 09:43:26 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/how-to-deal-with-real-imposters-5d08</link>
      <guid>https://dev.to/janpauldahlke/how-to-deal-with-real-imposters-5d08</guid>
      <description>&lt;p&gt;Since we all read a lot about imposter syndrom, we tend to see an unrecognized genius in our collegues.&lt;/p&gt;

&lt;p&gt;BUT? How to deal with an actual real imposter in your job?&lt;/p&gt;

&lt;p&gt;I have been hired for a nice project, JAVA Backend + REACT (SSR) Frontend, Webassembly, webGL and Azure, just to bring you some buzzwords. The run is planed for like 5 years, so to say, it is today already planned, what they want to do with the product in the future.&lt;/p&gt;

&lt;p&gt;After 10 years of beeing a developer, mostly Frontend, but also JSP/jinja/smartie and other templating stuff, i decided to take this position for the following reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;the stack looks familiar, but also there are some new things&lt;/li&gt;
&lt;li&gt;the lifetime of the project (to comparsion, most agency project last 3 months in coding)&lt;/li&gt;
&lt;li&gt;there will be a new team formed, since we take the project over and make it an internal company project&lt;/li&gt;
&lt;li&gt;my desire to become a senior developer (not only moneywise)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And when they hired me, they said, there will be an IT Team soon in our company. So far, so good.&lt;/p&gt;

&lt;p&gt;Then "the corana" happened and it was decided to hire only the Senior Architect, the HR found a promising candidate. No, they don't liked the indian guys, sadly. Still i  bet he was good at JAVA but bad in german (since iam german). &lt;br&gt;
They offered the job to someone else. It is a handsome, very charming, young and old, 10 years of experience as team-leader "senior software architect".&lt;/p&gt;

&lt;p&gt;Just after stalking him on xing (our german linkedin) i realized, that his buzzwords never fit to each other. he has 4 star experience in &lt;code&gt;C++/C#&lt;/code&gt;!! &lt;/p&gt;

&lt;p&gt;??&lt;br&gt;
!!&lt;/p&gt;

&lt;p&gt;WTF, in either one, or in both? i mean for me, its been worlds between microsoft .NET and C++, but ok...&lt;/p&gt;

&lt;p&gt;Then he has 4 Stars in JAVA/Android Studio? Hu? Java OR android or both or what? Iam confused.&lt;/p&gt;

&lt;p&gt;But, i am the smallest lightbulb in the world, so they hired him, and he gets paid well, since i know my salary, which is pretty ok, but it is not the money i am about.&lt;/p&gt;

&lt;p&gt;After talking to him for an hour, i realized he mixes terminology up. From my experience, if i dont develop daily, skills decay. I forget things, even the &lt;code&gt;any&lt;/code&gt; type in Hypescript (joke is on me).&lt;/p&gt;

&lt;p&gt;I wonder if it is reasonable to think, that someone who has not been in coding for 10 years, since his resumee is saying "PROJEKT MANAGER" and not "DEVELOPER", simply can not code.&lt;/p&gt;

&lt;p&gt;We talked. He didn't know that JAVA servers are configurable for the MEM they are allowed to use. &lt;br&gt;
He has no ****ing clue about JAVA changing it's business model and versioning, openjdk vs oracle java.&lt;/p&gt;

&lt;p&gt;He messes up PUT and POST and sends the same JSON-body on the same route, and asks me after two hours "why is this not working" (we use a swagger).&lt;/p&gt;

&lt;p&gt;So i told him: "please be honest, how good is your JAVA?"&lt;br&gt;
He replied: "i can learn fast, iam just learning spring boot on udemy right now."&lt;br&gt;
And then he said, and this made me really listen up. "In the job description the where looking for a nodejs guy", So his resume has 4 of 5 stars in JAVA/android, but he applied for nodejs?&lt;/p&gt;

&lt;p&gt;JEZ. I get confused about all the wrong buzzwords and project manager gibber he is talking. &lt;/p&gt;

&lt;p&gt;My boss asked me, what i think about my new collegue. What would you say in this moment? I tend to be diplomatic. "He is really nice. I like him. I hope he can show me things in backend, that will make me senior in 4-5 years too."&lt;/p&gt;

&lt;p&gt;I know this differs to the usual dev.to stuff, it's more a writeup. But let me get to the point.&lt;/p&gt;

&lt;p&gt;I think he is an imposter, since he knows what is paid in IT.&lt;/p&gt;

&lt;p&gt;How would you react if you find out your colleque is a liar about his skillset, wirite some tipps in the comments. &lt;/p&gt;

&lt;p&gt;TL:DR&lt;br&gt;
 Among all the smart guys with imposter-syndrome, are some real imposters, for the lulz and the $$$$&lt;/p&gt;

</description>
      <category>career</category>
    </item>
    <item>
      <title>console.fun() or how to mess up the DOM</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Wed, 13 Mar 2019 19:15:11 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/consolefun-or-how-to-mess-up-the-dom-2kkb</link>
      <guid>https://dev.to/janpauldahlke/consolefun-or-how-to-mess-up-the-dom-2kkb</guid>
      <description>&lt;p&gt;I stumbled upon this little gem in the &lt;a href="https://vue-land.js.org/"&gt;vue-land&lt;/a&gt; #random channel and it made me smile. Posted by &lt;em&gt;xan#2554&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Thought maybe it can make you smile too and decided to share it to you. Have fun.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;copy script&lt;/li&gt;
&lt;li&gt;visit your most preferred website -- ..most likely &lt;a href="//dev.to"&gt;dev.to&lt;/a&gt; 😜&lt;/li&gt;
&lt;li&gt;open console&lt;/li&gt;
&lt;li&gt;paste script and press &lt;code&gt;enter&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;funnyFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;screenwidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerWidth&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;screenheight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHeight&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;body *&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;randT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;screenheight&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;randL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;screenwidth&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;style&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transition-duration:500ms; transition-property: left, top; position: fixed; top:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;randT&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;px; left:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;randL&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;px&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;setInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;funnyFunction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&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;Be honest to yourself, did you knew what will happen? &lt;/p&gt;

&lt;p&gt;cheers&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>console</category>
      <category>fun</category>
    </item>
    <item>
      <title>i installed a 9 month old mini project again</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Fri, 09 Nov 2018 09:08:29 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/i-installed-a-9-month-old-mini-project-again-4nbm</link>
      <guid>https://dev.to/janpauldahlke/i-installed-a-9-month-old-mini-project-again-4nbm</guid>
      <description>&lt;p&gt;I installed a npm project again after 9 months...&lt;br&gt;
The package.json contained less then 10 entries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fPMIKX2z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/u19Rf6L.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fPMIKX2z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/u19Rf6L.png" alt="wtf"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This feels insecure, somehow.... but iam not an expert ;-)&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>npm</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to improve the build speed in React-Typescript, when using material ui</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Mon, 22 Oct 2018 09:44:47 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/how-to-improve-material-ui-speed-in-react-typescript-1199</link>
      <guid>https://dev.to/janpauldahlke/how-to-improve-material-ui-speed-in-react-typescript-1199</guid>
      <description>

&lt;p&gt;Hi,&lt;br&gt;
you are using material - ui in react typescript and having trouble with the performance? Well i stumpled upon the same issue.&lt;br&gt;
The build takes like forever, since i started to use material-ui and i was really no fun to code against such a lame project.&lt;/p&gt;

&lt;p&gt;But lets go in medias res and describe the scenario:&lt;/p&gt;

&lt;p&gt;I wrote a header component like this&lt;br&gt;
&lt;a href="https://i.imgur.com/3pMF0hO.png"&gt;Header&lt;/a&gt;. Pretty staright forward, right?&lt;/p&gt;

&lt;p&gt;While coding i went really unhappy, because the build and the livereolad grew pretty slow. So i played around with the Typescript compiler and found this little command&lt;br&gt;
&lt;code&gt;tsc --diagnostics --listFiles&lt;/code&gt; which i made an alias &lt;code&gt;healtcheck&lt;/code&gt; in my package.json. &lt;/p&gt;

&lt;p&gt;Running it was painfull and ended in results like&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Files:          5598
Lines:        108833
Nodes:        453997
Identifiers:  146625
Symbols:      217251
Types:         56743
Memory used: 300772K
I/O read:      4.66s
I/O write:     0.48s
Parse time:   26.90s
Bind time:     1.62s
Check time:    9.72s
Emit time:     1.64s
Total time:   39.87s
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you guys can easily see, it takes quite some time and runs to a TON of files.&lt;/p&gt;

&lt;p&gt;I imported the two icons for the header like this:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
  AccountCircle,
  Language
} from '@material-ui/icons';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And i was wondering about the mass of files that &lt;code&gt;--diagnostics&lt;/code&gt; considered when building, especially the trillions of &lt;code&gt;/node_modules/@material-ui/icons/**.d.ts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Yes iam a typescript user, and althought i had some troubles to get into it, i really like it now. As you might know, if a package does not bring its own typings, there is a huge community in &lt;a href="https://github.com/DefinitelyTyped/"&gt;DefinitlyTyped&lt;/a&gt; on github, that provides typings for large packages.&lt;/p&gt;

&lt;p&gt;For example: one would get the typings for material-ui like this: &lt;code&gt;npm install --save-dev @types/material-ui&lt;/code&gt;, with the result of beeing able to consume material-ui in the typescript world.&lt;/p&gt;

&lt;p&gt;But a build time of nearly 40seconds? I wanted to improve this and did some research at big brother.&lt;br&gt;
Found this github &lt;a href="https://github.com/mui-org/material-ui/issues/11916"&gt;issue&lt;/a&gt; that point to the same problem. And i was really happy to read this &lt;a href="https://github.com/mui-org/material-ui/issues/11916#issuecomment-429984950"&gt;comment&lt;/a&gt; with a major improvement.&lt;/p&gt;

&lt;p&gt;Instead of importing like above, i simply rewrote my import of the icons to:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import AccountCircle from '@material-ui/icons/AccountCircle';
import  Language from '@material-ui/icons/Language';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Lets see how much this impacts our &lt;code&gt;healtcheck&lt;/code&gt; now:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Files:           382
Lines:         98396
Nodes:        386176
Identifiers:  130972
Symbols:      201601
Types:         56743
Memory used: 245687K
I/O read:      0.35s
I/O write:     0.37s
Parse time:    4.29s
Bind time:     0.79s
Check time:    5.16s
Emit time:     1.44s
Total time:   11.69s
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Wow! Iam was speechless by such a little change, but with an impact like this. We gained nearly 30seconds by altering 2 lines, i mean it could be more lines, but by &lt;strong&gt;NOT IMPORTING VIA THE INDEX&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Iam glad i could share this to you, and it will maybe help the one or another. &lt;/p&gt;

&lt;p&gt;My name is JanPaul and iam working for &lt;a href="http://www.instant-data.com/"&gt;instant-data&lt;/a&gt;. We are small company, that provides internal tooling for large agencies and also data-exchange platforms.&lt;/p&gt;

&lt;p&gt;May the code be with you :pray:&lt;br&gt;
Thanks for the title image to &lt;a href="https://unsplash.com/@emilbruckner"&gt;Emil Bruckner&lt;/a&gt; @unsplash.&lt;/p&gt;


</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>materialui</category>
      <category>react</category>
    </item>
    <item>
      <title>reducks, a boilerplate</title>
      <dc:creator>jan paul</dc:creator>
      <pubDate>Tue, 11 Sep 2018 18:27:54 +0000</pubDate>
      <link>https://dev.to/janpauldahlke/rate-my-boilerplate-j8c</link>
      <guid>https://dev.to/janpauldahlke/rate-my-boilerplate-j8c</guid>
      <description>

&lt;p&gt;&lt;a href="https://unsplash.com/@jaseess"&gt;img by Jase Ess&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Hello dear dev.to,&lt;/h1&gt;

&lt;p&gt;Iam working for &lt;a href="http://www.instant-data.com/"&gt;instant-data&lt;/a&gt;. a small company that provides solutions in the environment of a larger advertising agency. mostly internal toolings.&lt;/p&gt;

&lt;p&gt;After playing round a little with the create-react-app, i wanted to share my latest boilerplate with you and ask for your opinions, or improvements. You can visit me  &lt;a href="https://github.com/janpauldahlke/react-ts-boilerplate-2018/"&gt;here&lt;/a&gt; on github.&lt;br&gt;
In this i follow the ducks pattern, &lt;b&gt; in which you try to keep all your redux and store reducer stuff in one single file&lt;/b&gt;, but for sakes of DRY, i will present you the README.MD. I appreciate any feedback ;-)&lt;/p&gt;

&lt;p&gt;It is created via the CLI-Tool &lt;br&gt;
&lt;br&gt;
&lt;code&gt;create-react-app &amp;lt;your-appname&amp;gt; --scripts-version=react-scripts-ts&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 and customized to my needs, by running &lt;br&gt;
&lt;br&gt;
&lt;code&gt;npm eject&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;Prequisites&lt;/h3&gt;

&lt;p&gt;Installed node and npm Version 8 or higher.&lt;/p&gt;

&lt;h2&gt;Available Scripts&lt;/h2&gt;

&lt;p&gt;In the project directory, you can run:&lt;/p&gt;

&lt;h4&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;Open &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; to view it in the browser.&lt;/p&gt;

&lt;h4&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;Builds the app for production to the &lt;code&gt;build&lt;/code&gt; folder.&lt;/p&gt;

&lt;h4&gt;
&lt;code&gt;npm run seed&lt;/code&gt; Authentication seed&lt;/h4&gt;

&lt;p&gt;To make the boilerplate work from scratch, and to simulate the flow of Auth, we put a JSON-Server.&lt;br&gt;
You should remove the complete seed folder, or better add it to your &lt;code&gt;.gitignore&lt;/code&gt;, when you implement your own workflow. To make use of it simply &lt;code&gt;npm run seed&lt;/code&gt;. You will get served at &lt;code&gt;json-server --port 4000 --watch -- seed/db.json&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;Folder Structure&lt;/h4&gt;

&lt;p&gt;After creation, your project should look like this:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-app/
  README.md
  node_modules/
  package.json
  public/
    index.html
    favicon.ico
  seed/
    /* a helper fake backend for firsttimers */  
  src/
    index.tsx
    components/
      App.tsx
    containers/
      /* your connected containers here */
    ducks/
      /* your ducks here */
    services/
      /* put all your global helpers inside here */
    store/
      history.ts
      index.ts
      localStorage.ts
  types/
    /*your types go here */  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;Debugging and DevTools&lt;/h4&gt;

&lt;p&gt;I strongly suggest you to install and use theses BrowserExtensions.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd"&gt;redux-devtools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi"&gt;react-devtools&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Material-UI and Decorators&lt;/h4&gt;

&lt;p&gt;The experimental feature for Decorators is activated in the &lt;code&gt;tsconfig.json&lt;/code&gt;. By this it is possible to use the withStyle decorator in combination with &lt;code&gt;compose&lt;/code&gt; of the &lt;code&gt;recompose package&lt;/code&gt;. &lt;br&gt;
Example usage is:&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;compose&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'recompose'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;withStyles&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@material-ui/core/styles'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@(&lt;/span&gt;&lt;span class="nx"&gt;compose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;withStyles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Example&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;IExampleProps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;IExampleState&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{...}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To make use of themes in material-ui we need to wrap the content of App inside a&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MuiThemeProvider&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;createMuiTheme&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c1"&gt;//any content here&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MuiThemeProvider&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;&lt;a href="https://material-ui.com/customization/themes/"&gt;read more about Material UI Themes&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Environment&lt;/h3&gt;

&lt;p&gt;There is the possibility to provide ENV variables. use the &lt;code&gt;.env&lt;/code&gt; file for this.&lt;br&gt;
Please note, they need to follow the naming convention of &lt;code&gt;REACT_APP_&lt;/code&gt; &lt;code&gt;EXAMPLE=FOOBAR&lt;/code&gt;.&lt;br&gt;
Inside the project one can consume them by &lt;code&gt;proccess.env.REACT_APP_EXAMPLE&lt;/code&gt;. &lt;br&gt;
At a new start its set to the seedings path, so one might want to change it there.&lt;/p&gt;

&lt;h3&gt;HTTP Requests&lt;/h3&gt;

&lt;p&gt;Please use axios for your requests. It supports Promises and also async/await.&lt;br&gt;
&lt;a href="https://github.com/axios/axios"&gt;https://github.com/axios/axios&lt;/a&gt;&lt;br&gt;
Also make sure the allow crossorigin-access on your server.&lt;/p&gt;

&lt;h3&gt;Ducks&lt;/h3&gt;

&lt;p&gt;We follow the 'Ducks'-Pattern to structure our application. Get insights on this specc here&lt;br&gt;
&lt;a href="https://github.com/erikras/ducks-modular-redux"&gt;https://github.com/erikras/ducks-modular-redux&lt;/a&gt; &lt;br&gt;
The pattern is to have all these inside one duck:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;action enum&lt;/li&gt;
&lt;li&gt;action types&lt;/li&gt;
&lt;li&gt;action creators&lt;/li&gt;
&lt;li&gt;reducer functions&lt;/li&gt;
&lt;li&gt;mainreducer&lt;/li&gt;
&lt;li&gt;thunk&lt;/li&gt;
&lt;li&gt;initialStore&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Message Component&lt;/h3&gt;

&lt;p&gt;There is a rudimental example prepared in this boilerplate, that shows usage and consumption of a high level message or notification-component. Import the NofictationDuck inside the Ducks that you want the NotificationStore to be catched.&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;NotificationDuck&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'~/src/ducks/notification'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;your&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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="cm"&gt;/* success */&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;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;NotificationDuck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;throwNotificationWithError&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'your text'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'your title'&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;But you can also connect them directly to components. Please keep in mind to reset the NotificationStore, with the &lt;code&gt;RESET_NOTIFICATION_STORE&lt;/code&gt; action! &lt;/p&gt;

&lt;h3&gt;Store&lt;/h3&gt;

&lt;p&gt;Use the folder &lt;code&gt;src/store&lt;/code&gt; to configure the store of redux according to your needs. There is also the possibilty to subscribe parts of the store to your localStorage. To do so check the &lt;code&gt;index.ts&lt;/code&gt; and have a brief look at the store subscribe pattern.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;throttle&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="nx"&gt;storage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;RootState&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;AuthStore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AuthStore&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nx"&gt;saveState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="nx"&gt;AuthStore&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;RootState&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Please make use of the &lt;code&gt;throttle&lt;/code&gt; lodash-helper. &lt;code&gt;JSON.parse()/JSON.stringyfy&lt;/code&gt; are expensive in Javascript.&lt;/p&gt;

&lt;h2&gt;Services&lt;/h2&gt;

&lt;p&gt;Anything you want to consume repetitive belongs to the services. Another word could be globalHelpers.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;apicontroller -&amp;gt; an axois instance the can be configured. import it into your ducks to make &lt;code&gt;http&lt;/code&gt;-verbs.&lt;/li&gt;
&lt;li&gt;authenticationService -&amp;gt; can be used in conjunction with apicontroller inside of ducks to verify auth-Status&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;inside your duck - an example usage in thunk&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;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../../services/apicontroller'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kr"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;getAuth&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="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;:()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;RootState&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&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;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AuthDuck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAuthAction&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

      &lt;span class="c1"&gt;//return the axois object with header, pass the state by `getState()` to auth and GET the route with `get('/yourRoute')`&lt;/span&gt;

      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/Authentication'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&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="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AuthDuck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAuthSuccessAction&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="nx"&gt;data&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="na"&gt;err&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Error&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="cm"&gt;/**
        });
    };
  }
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;There is also a whole &lt;code&gt;react-router&lt;/code&gt; v4 part, i will explain at 50 :heart: :-)&lt;/p&gt;


</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>react</category>
      <category>reducks</category>
    </item>
  </channel>
</rss>
