<?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: Martin Anders</title>
    <description>The latest articles on DEV Community by Martin Anders (@madflanderz).</description>
    <link>https://dev.to/madflanderz</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%2F253980%2F8b2e3f0e-2931-4a83-89c9-50013cb39f7c.jpeg</url>
      <title>DEV Community: Martin Anders</title>
      <link>https://dev.to/madflanderz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madflanderz"/>
    <language>en</language>
    <item>
      <title>React (Native) Interview questions</title>
      <dc:creator>Martin Anders</dc:creator>
      <pubDate>Thu, 06 Jun 2024 12:04:31 +0000</pubDate>
      <link>https://dev.to/madflanderz/react-native-interview-questions-31dp</link>
      <guid>https://dev.to/madflanderz/react-native-interview-questions-31dp</guid>
      <description>&lt;h2&gt;
  
  
  React Native Lead Developer Interview Questions:
&lt;/h2&gt;

&lt;p&gt;Recently i had to interview someone to join my company. HR was requesting that I do a coding interview but did not like the idea. I prefer instead just to talk about different things that you can answer only when you really into the topic.&lt;/p&gt;

&lt;h3&gt;
  
  
  React Native
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What do you like about React Native?&lt;/li&gt;
&lt;li&gt;What do you dislike about React Native?&lt;/li&gt;
&lt;li&gt;What is your experience with React Native upgrades?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  React State Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What state management solutions have you used in React Native?&lt;/li&gt;
&lt;li&gt;What are the pros and cons of different state management approaches in React Native?&lt;/li&gt;
&lt;li&gt;Can and should you use the Context API exclusively for state management in React Native?&lt;/li&gt;
&lt;li&gt;What are some common challenges with state management in React Native?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What testing tools do you use in your daily work with React Native?&lt;/li&gt;
&lt;li&gt;Are there any specific testing tools or frameworks you would like to use?&lt;/li&gt;
&lt;li&gt;Can you explain the Testing Trophy concept and how it applies to React Native testing?&lt;/li&gt;
&lt;li&gt;What is your philosophy on testing with React Native?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Feature Flags
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Is it possible to conditionally execute hooks in React Native? If so, how?&lt;/li&gt;
&lt;li&gt;Rules of hooks?&lt;/li&gt;
&lt;li&gt;How would you implement feature flags in a React Native project?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  General Questions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What was the hardest problem you had to solve in your last React Native app/project?&lt;/li&gt;
&lt;li&gt;What was the coolest feature you implemented in your last React Native app/project?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance Optimization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What techniques have you used to optimize the performance of React Native apps?&lt;/li&gt;
&lt;li&gt;How do you approach profiling and debugging performance issues in React Native?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Code Quality and Best Practices
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What coding standards and best practices do you follow in React Native development?&lt;/li&gt;
&lt;li&gt;How do you ensure code quality and consistency in a React Native project?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Collaboration and Teamwork
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How do you ensure effective collaboration among developers in a React Native project?&lt;/li&gt;
&lt;li&gt;How do you handle situations where team members have conflicting opinions or ideas?&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>interview</category>
      <category>hr</category>
    </item>
    <item>
      <title>How to apply responsive font sizes in Tailwind</title>
      <dc:creator>Martin Anders</dc:creator>
      <pubDate>Sat, 24 Dec 2022 16:50:46 +0000</pubDate>
      <link>https://dev.to/madflanderz/how-to-apply-responsive-font-sizes-in-tailwind-2fmf</link>
      <guid>https://dev.to/madflanderz/how-to-apply-responsive-font-sizes-in-tailwind-2fmf</guid>
      <description>&lt;p&gt;Tailwind CSS is a popular utility-first CSS framework that makes it easy to style your applications using predefined classes. One useful feature of Tailwind is the ability to apply responsive font sizes using media queries. In this blog post, we'll take a look at how to use media queries in Tailwind to apply responsive font sizes to your text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Media queries in Tailwind
&lt;/h2&gt;

&lt;p&gt;Tailwind includes a number of utility classes that allow you to apply styles based on the size of the viewport. These utility classes are prefixed with the size abbreviation, followed by a colon (e.g. sm:, md:, lg:, etc.). For example, you can use the sm: prefix to apply styles only on small screens, or the lg: prefix to apply styles only on large screens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Applying responsive font sizes
&lt;/h2&gt;

&lt;p&gt;To apply responsive font sizes in Tailwind, you can use the text- utility classes along with media queries. For example, to apply a larger font size on small screens and a smaller font size on large screens, you can use the following classes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-lg sm:text-sm&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Small&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;small&lt;/span&gt; &lt;span class="nx"&gt;screens&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&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;In this example, the &lt;strong&gt;text-lg&lt;/strong&gt; class will be applied on all screen sizes, while the &lt;strong&gt;sm:text-sm&lt;/strong&gt; class will apply a smaller size only on small screens.&lt;/p&gt;

&lt;p&gt;Even though this is a valid solution it can be challenging in a bigger project to ensure that all devs use the same styles and responsive adjustments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a custom Typography component
&lt;/h2&gt;

&lt;p&gt;While applying responsive font sizes using media queries and the &lt;strong&gt;text-&lt;/strong&gt; utility classes is a simple and effective method, you may find that it becomes cumbersome to repeat this process for each element in your application. In this case, it may be more convenient to create a custom Typography component that encapsulates this logic and makes it easier to apply responsive font sizes to your text.&lt;/p&gt;

&lt;p&gt;For example, you could create a Typography component like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;ElementType&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="s2"&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;type&lt;/span&gt; &lt;span class="nx"&gt;Variant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body-small&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Variant&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&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;ReactNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;className&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;as&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;ElementType&lt;/span&gt;&lt;span class="p"&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;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Variant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;p&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="s2"&gt;body-small&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="s2"&gt;p&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;small&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;span&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;sizes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Variant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-5xl font-bold sm:text-4xl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-4xl font-bold sm:text-3xl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-3xl font-bold sm:text-2xl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-2xl font-bold sm:text-1xl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;h5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-xl font-bold sm:text-lg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-lg sm:text-md&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="s2"&gt;body-small&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="s2"&gt;text-md sm:text-sm&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;small&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-sm sm:text-xs&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;as&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="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;sizeClasses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sizes&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;variant&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;Tag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Tag&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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;sizeClasses&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;className&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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Tag&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can user this component like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Typography&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;./Typography&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ...&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Heading&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Typography&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Body&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Typography&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Small&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Typography&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;With this custom Typography component, you can easily apply responsive font sizes to your text in a way that's similar to how Material-UI does it. Simply pass in the desired variant (e.g. 'h1', 'body1') and the component will handle the rest.&lt;/p&gt;

&lt;p&gt;Full example code you can find here:&lt;br&gt;
&lt;a href="https://codesandbox.io/s/immutable-worker-wk092o?file=/src/App.tsx:309-414"&gt;Codesandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, applying responsive font sizes in Tailwind is a simple matter of using media queries and the text- utility classes. Alternatively, you can create a custom Typography component that encapsulates this logic and makes it easier to apply responsive font sizes to your text. This can be especially convenient if you have many elements in your application that need to have responsive font sizes applied to them.&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>react</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to promote your NFT project</title>
      <dc:creator>Martin Anders</dc:creator>
      <pubDate>Fri, 28 Jan 2022 23:44:45 +0000</pubDate>
      <link>https://dev.to/madflanderz/how-to-promote-your-nft-project-3a6j</link>
      <guid>https://dev.to/madflanderz/how-to-promote-your-nft-project-3a6j</guid>
      <description>&lt;p&gt;Some days ago we finished our first NFT project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;COOLPHABET - The Cool Letters Crew&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://www.coolphabet.art/"&gt;https://www.coolphabet.art/&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/CoolphabetNFT"&gt;https://twitter.com/CoolphabetNFT&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Building this project was quite nice and we learned to much. Big thank you to &lt;a href="https://buildspace.so/"&gt;_buildspace&lt;/a&gt; and &lt;a href="https://twitter.com/developer_dao"&gt;DeveloperDAO&lt;/a&gt; for all the help to get into the web3 space.&lt;/p&gt;

&lt;p&gt;But after building a cool project there is one important thing missing that you shouldn't forget: &lt;strong&gt;PROMOTION&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are 4 ways to get some attention from people.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. NFT project drop lists
&lt;/h2&gt;

&lt;p&gt;There are a lot websites where you can list your project. The most of them are completely free, but you can get also additional promotion for some extra money. We listed our project on all of these websites:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.nextnftdrop.com/"&gt;https://www.nextnftdrop.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftprojectlist.com/"&gt;https://nftprojectlist.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://upcomingnft.net/"&gt;https://upcomingnft.net/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftcalendar.io/"&gt;https://nftcalendar.io/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://upcomingnft.art/"&gt;https://upcomingnft.art/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://rarity.tools/upcoming/"&gt;https://rarity.tools/upcoming/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nft-list.io/"&gt;https://nft-list.io/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.nftcatcher.io/"&gt;https://www.nftcatcher.io/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftevening.com/"&gt;https://nftevening.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.plotlion.com/nft-watchlist"&gt;https://www.plotlion.com/nft-watchlist&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftgenie.pro/"&gt;https://nftgenie.pro/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftaggregator.io"&gt;https://nftaggregator.io&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftvibe.io/coolphabet/"&gt;https://nftvibe.io/coolphabet/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nftdesire.io/"&gt;https://nftdesire.io/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://notfin.com/"&gt;https://notfin.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Twitter
&lt;/h2&gt;

&lt;p&gt;Twitter seams to me THE most important social media platform to promote your NFT projects. You should start as early as possible to get a follower base before your project is done. We made the mistake to start our twitter account AFTER we finished our project and just 2 weeks before the mint day. 🤦🏻‍♀️&lt;br&gt;
We still need some more &lt;a href="https://twitter.com/CoolphabetNFT"&gt;followers&lt;/a&gt; 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Discord
&lt;/h2&gt;

&lt;p&gt;Discord is after Twitter the other main player when it comes to community building. Many projects start early with a own discord server to get user feedback and to build a relation with future customers. We don't have a discord server because we had already enough todos on our list but you should consider to use it.&lt;/p&gt;

&lt;p&gt;Even if you don't have a custom server you still can use discord to promote your project in channels of other projects. You can look for channels like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;showcase&lt;/li&gt;
&lt;li&gt;shill your project&lt;/li&gt;
&lt;li&gt;show your content&lt;/li&gt;
&lt;li&gt;boost your stuff&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Tell everyone
&lt;/h2&gt;

&lt;p&gt;Just tell your friends, your family or your work colleagues about your project. Post it on Instagram or Facebook. Or write articles like this one 🥳😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Build cool stuff, YES. But promotion should be part of your project from day one. You will need this to be successful. If you struggle to do this by yourself peer up with other people that have more experience and can help you. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Twitter Author: &lt;a href="https://twitter.com/AndersCode"&gt;https://twitter.com/AndersCode&lt;/a&gt;&lt;br&gt;
Website: &lt;a href="https://www.coolphabet.art/"&gt;https://www.coolphabet.art/&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/CoolphabetNFT"&gt;https://twitter.com/CoolphabetNFT&lt;/a&gt;&lt;br&gt;
Learn web3: &lt;a href="https://buildspace.so/"&gt;_buildspace&lt;/a&gt;&lt;br&gt;
Community: &lt;a href="https://twitter.com/developer_dao"&gt;DeveloperDAO&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Coolphabet NFT - from learning web3 to production</title>
      <dc:creator>Martin Anders</dc:creator>
      <pubDate>Mon, 24 Jan 2022 21:44:30 +0000</pubDate>
      <link>https://dev.to/madflanderz/coolphabet-nft-from-learning-web3-to-production-deployment-3496</link>
      <guid>https://dev.to/madflanderz/coolphabet-nft-from-learning-web3-to-production-deployment-3496</guid>
      <description>&lt;p&gt;In October i discovered &lt;a href="https://twitter.com/_buildspace"&gt;_buildspace&lt;/a&gt; on Twitter. Buildspace is a very great place where you can learn some basic web3 stuff like coding SmartContracts for different blockchains like Ethereum or Solana. I did a course and it was very interesting and i was really motivated to build a real NFT project with the knowledge is learned there. Sooo, how we can start? The most important part for an NFT is some art, right? I'm just a poor coder without any design capabilities 🤪 but lucky me, my girlfriend is a professional visual designer, yipiiii. Let's go and create a cool NFT collection, could be just a matter of some hours. &lt;/p&gt;

&lt;p&gt;Some hours??? Haha, Now 3 months later we are finally there. Our project is done 🚀🥳🍾&lt;/p&gt;

&lt;h2&gt;
  
  
  Coolphabet - The Cool Letters Crew
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Coolphabet - The Cool Letters Crew&lt;/strong&gt; is a NFT collection based on the ethereum blockchain. There are &lt;strong&gt;216 unique letters&lt;/strong&gt;, generated from all alphabetical characters and numbers. They come in six different color schemes and have a very fresh, beautiful and strong look. They are here to be yours! Be part of the crew!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b9gWwR-r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h0qqii43cjci0k4x3q0a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b9gWwR-r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h0qqii43cjci0k4x3q0a.gif" alt="Coolphabet NFTs" width="600" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://www.coolphabet.art/"&gt;https://www.coolphabet.art/&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/CoolphabetNFT"&gt;https://twitter.com/CoolphabetNFT&lt;/a&gt;&lt;br&gt;
Opensea: &lt;a href="https://opensea.io/collection/coolphabet"&gt;https://opensea.io/collection/coolphabet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mint will start on 31.01.2022 18:00 UTC&lt;/p&gt;
&lt;h2&gt;
  
  
  What you should know when you like to do the same
&lt;/h2&gt;

&lt;p&gt;It's a huge step from building a sample project to finish a real world project. There is so much stuff to do to reach your goal. Here are some important insights what we discovered while building this project.&lt;/p&gt;
&lt;h3&gt;
  
  
  Writing the smart contract
&lt;/h3&gt;

&lt;p&gt;For me it was very cool to learn how to write code for a worldwide super computer. Solidity is a nice language and as a Typescript developer like me you feel comfortable very fast. &lt;br&gt;
But there is one thing that is very scary to me: When the smart contract is deployed to the blockchain it will be there forever and you can't change it anymore. As a developer this seems to be like a nightmare 👻. You have to be really really sure that the stuff you write will work. You have to test it very well. Imagine your NFT project is super sucessful, you earned a shitload of money and then you want to withdraw it and BOOOM -&amp;gt; contract error &amp;lt;- ARRRGGHHHHHH. &lt;br&gt;
To solve this problem you could either use code that is battle tested like [the openzepplin contracts(&lt;a href="https://openzeppelin.com/contracts/"&gt;https://openzeppelin.com/contracts/&lt;/a&gt;) or write unit tests to check the functionallity of your custom code. The final contract you can find here:&lt;br&gt;
&lt;a href="https://etherscan.io/address/0x9003c570B6D16b271FEFC11B885325EC953B24EB#code"&gt;Ethercan contract&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Building the website
&lt;/h3&gt;

&lt;p&gt;This part is pretty easy for a web developer. You can use the framework of your choice and then you just have to learn the api of &lt;a href="https://github.com/ethers-io/ethers.js"&gt;ether.js&lt;/a&gt; to build a web3 site that can interact with the smart contract. &lt;/p&gt;
&lt;h3&gt;
  
  
  Deploying the smart contract to the ethereum mainnet
&lt;/h3&gt;

&lt;p&gt;Last week our website and the smart contract were ready to deploy. Let's go and deploy. But wait - how do we do this? How expensive is it to deploy a contract to the mainnet? What if there are some errors? Will we loose all the money when the deployment fails? AHHHHHHH, anxiety, stress. All this stuff was in my head.&lt;/p&gt;
&lt;h4&gt;
  
  
  Calculate the deployment costs
&lt;/h4&gt;

&lt;p&gt;To get an impression how much money you need to deploy a smart contact you can do this&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;check a testnet deployment of your contract, i.e. &lt;a href="https://rinkeby.etherscan.io/tx/0xc445ea69e155a692b7f9008af3d309598e4f75051bc612ff5978522ed46dea73"&gt;https://rinkeby.etherscan.io/tx/0xc445ea69e155a692b7f9008af3d309598e4f75051bc612ff5978522ed46dea73&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;find "Gas Limit &amp;amp; Usage", for our contract it is 3,678,612 Gas&lt;/li&gt;
&lt;li&gt;get the current gas price &lt;a href="https://ethgas.watch/"&gt;here&lt;/a&gt;, it's 192 while i'm writing this here&lt;/li&gt;
&lt;li&gt;multiply both numers 3,678,612 * 192 = 706,293,504 GWEI&lt;/li&gt;
&lt;li&gt;convert GWEI to ETH &lt;a href="https://nomics.com/markets/gwei-gwei/eth-ethereum"&gt;here&lt;/a&gt; 706,293,504 GWEI = 0,703568 ETH
Cool, now we know how much ETH we approximately need in our wallet to deploy the smart contract.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Find a good time for deployment
&lt;/h4&gt;

&lt;p&gt;As you can see the price is directly depended on the gas price. &lt;a href="https://ethereumprice.org/gas/"&gt;Here&lt;/a&gt; you can see a nice graph of the last weeks prices for every hour of the day. Find a good time where the price is low. The beginning of the week is normally less expensive then the weekend. Just be patient BUT prepared to do the deployment when the price is low.&lt;/p&gt;
&lt;h4&gt;
  
  
  Deploy to mainnet
&lt;/h4&gt;

&lt;p&gt;When i started the project i used &lt;a href="https://hardhat.org/"&gt;hardhat&lt;/a&gt; and &lt;a href="https://www.alchemy.com/"&gt;alchemy&lt;/a&gt; to develop, test and deploy. Deployments to the rinkeby testnet were always easy and fast, so let's change the credentials and deploy to the mainnet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hardhat run scripts/deploy.ts &lt;span class="nt"&gt;--network&lt;/span&gt; mainnet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And wait ...&lt;br&gt;
and wait ...&lt;/p&gt;

&lt;p&gt;Mhhhh after 5 min still running without any output. Damn. What if this fails and all the money is gone? Can i abort this deployment? What should i do?&lt;/p&gt;

&lt;p&gt;I checked other solutions and decided to give &lt;a href="https://remix.ethereum.org/"&gt;Remix&lt;/a&gt; a try. The advantage of using remix is that you can use your browser metamask wallet to deploy the contract instead of doing it from your computers command line. Find the deploy button and hit - boooom!&lt;/p&gt;

&lt;p&gt;YEEEESSSSS, here we go. Coolphabet is live in the Ethereum Mainnet with deploy costs of 614.48 USD. 🥳🥳🥳&lt;/p&gt;

&lt;h3&gt;
  
  
  Promotion
&lt;/h3&gt;

&lt;p&gt;Now comes the hardest part - how can we promote our NFT project? A good start are nft drop lists like &lt;a href="https://www.nextnftdrop.com/projects/coolphabet/"&gt;nextnftdrop&lt;/a&gt;, &lt;a href="https://upcomingnft.net/event/coolphabet/"&gt;upcomingnft&lt;/a&gt; and others. &lt;br&gt;
Some sites are free, other sites want a fee to add your project.&lt;/p&gt;

&lt;p&gt;Another very important promotion channel is &lt;a href="https://twitter.com/CoolphabetNFT"&gt;Twitter&lt;/a&gt;. You could &lt;a href="https://twitter.com/CoolphabetNFT"&gt;follow and like us&lt;/a&gt; if you would like to help us 😉 &lt;/p&gt;

&lt;h3&gt;
  
  
  Final thoughts
&lt;/h3&gt;

&lt;p&gt;It was pretty fun to enter #web3, learn all the fundamentals and deploy our first smart contract for the eternity to the ethereum blockchain. Feel free to contact us if you have some ideas for new projects and need help with design or development.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>react</category>
      <category>nextjs</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>How to get parts of an typescript interface</title>
      <dc:creator>Martin Anders</dc:creator>
      <pubDate>Mon, 05 Oct 2020 16:15:57 +0000</pubDate>
      <link>https://dev.to/madflanderz/how-to-get-parts-of-an-typescript-interface-3mko</link>
      <guid>https://dev.to/madflanderz/how-to-get-parts-of-an-typescript-interface-3mko</guid>
      <description>&lt;p&gt;Today i wanted to extract a part of an already existing complex typescript type or interface.&lt;/p&gt;

&lt;p&gt;It's very difficult to google something when you don't know what to search for. This post will help you if you have one of these questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to get a nested type?&lt;/li&gt;
&lt;li&gt;How to get parts of an interface?&lt;/li&gt;
&lt;li&gt;How to get type of array elements?&lt;/li&gt;
&lt;li&gt;How to extract optional properties of a type?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I searched for this by myself and was not happy with the results.&lt;/p&gt;

&lt;h3&gt;
  
  
  So let's start
&lt;/h3&gt;

&lt;p&gt;Let's say we have this type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
    &lt;span class="c1"&gt;// nested object&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;street&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// nested array&lt;/span&gt;
    &lt;span class="nl"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="c1"&gt;// optional object&lt;/span&gt;
    &lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;eyeColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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;h3&gt;
  
  
  Extract basic parts
&lt;/h3&gt;

&lt;p&gt;To extract specific parts of this type we can use &lt;a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html#example-1"&gt;lookup types&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;age&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Address&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;address&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;// deeply nested access is also possible&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Street&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;address&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="s2"&gt;street&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Extract type of array elements
&lt;/h3&gt;

&lt;p&gt;To get the type of an typed array like &lt;code&gt;tags&lt;/code&gt; we can use the lookup type for arrays:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Tag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Optional properties
&lt;/h3&gt;

&lt;p&gt;But how get the type of optional properties like &lt;code&gt;info&lt;/code&gt; correctly? Let's say we want the type of &lt;code&gt;eyeColor&lt;/code&gt;. To get base type of optional types properties correctly we have to use &lt;a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype"&gt;&lt;code&gt;NunNullable type&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Info&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;NonNullable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;info&lt;/span&gt;&lt;span class="dl"&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="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;EyeColor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Info&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;eyeColor&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;// string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Get type from Array values
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;languages&lt;/span&gt; &lt;span class="o"&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;de&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;en&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;fr&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;it&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// extract type from languages above&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;languages&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// same as de" | "en" | "fr" | "it"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Final thoughts
&lt;/h3&gt;

&lt;p&gt;Another day for me with more typescript enlightenment 😆. Hope this post can help you as well.  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Modern State Management with Overmind.js</title>
      <dc:creator>Martin Anders</dc:creator>
      <pubDate>Mon, 27 Jan 2020 14:44:38 +0000</pubDate>
      <link>https://dev.to/madflanderz/modern-state-management-with-overmind-js-3hla</link>
      <guid>https://dev.to/madflanderz/modern-state-management-with-overmind-js-3hla</guid>
      <description>&lt;p&gt;Handling state in an application is like juggling with data. This article is about a very interesting way of handling state in your React app with &lt;a href="https://overmindjs.org"&gt;Overmind.js&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Overmind?
&lt;/h2&gt;

&lt;p&gt;There are many tools for state management out there like &lt;a href="https://kentcdodds.com/blog/how-to-use-react-context-effectively"&gt;Context-API&lt;/a&gt;, &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt;, &lt;a href="https://mobx.js.org"&gt;MobX&lt;/a&gt; or &lt;a href="https://github.com/mobxjs/mobx-state-tree"&gt;MST&lt;/a&gt;. So why we want another one?&lt;/p&gt;

&lt;p&gt;In my latest client project I used &lt;a href="https://kentcdodds.com/blog/how-to-use-react-context-effectively"&gt;context based state&lt;/a&gt; together with &lt;a href="https://www.apollographql.com/docs/react/"&gt;Apollo Client&lt;/a&gt;. I'm a huge fan of React Hooks and together with Context-API it's a very nice way to handle state in your application. It seemed to me that I didn't need any bigger state management solution like &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt; anymore. In the beginning this was totally fine and I was happy with this approach but after two months the app became bigger and complexity was growing. I wasn't happy anymore and I decided it's time to switch to a different solution. &lt;/p&gt;

&lt;p&gt;Back in the days I used and liked &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt; a lot and I felt very comfortable with it, but it always had a smell of "too-much-code" for small stuff. On the other hand I never really used &lt;a href="https://mobx.js.org"&gt;MobX&lt;/a&gt; but heard only good things about it. After doing some research I found new library called &lt;a href="https://overmindjs.org"&gt;Overmind&lt;/a&gt; which locked pretty interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Combining the best together
&lt;/h2&gt;

&lt;p&gt;Overmind was created by &lt;a href="https://christianalfoni.herokuapp.com/"&gt;Christian Alfoni&lt;/a&gt; with the goal to give the best developer experience as possible and also to have strong TypeScript support. The framework internals are hidden to the developer and the API is very simple and straight forward.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;strong TypeScript support &lt;/li&gt;
&lt;li&gt;very simple API &lt;/li&gt;
&lt;li&gt;good documentation and easy to learn&lt;/li&gt;
&lt;li&gt;great devtools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think one of the best things you get with Overmind is that you have fully typed code nearly for free.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining state
&lt;/h3&gt;

&lt;p&gt;Define your state as a simple object. Even if it is Typescript you can define your state as simple like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&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="c1"&gt;// title: string&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="c1"&gt;// count: number&lt;/span&gt;
  &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  
  &lt;span class="c1"&gt;// foo: Foo | null&lt;/span&gt;
  &lt;span class="na"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Foo&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&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;blockquote&gt;
&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt; Don't use undefined or ? in your state because it is just considered an anti pattern. Any undefined value on a state will not show up in the devtools, it will not be passed to server or saved in local storage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Everywhere you use the state you have full TypeScript support and code completion. SIMPLE, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  Derived state
&lt;/h3&gt;

&lt;p&gt;Derived state are computed values based on other state. In Overmind you define your derived state directly next to the state.&lt;/p&gt;

&lt;p&gt;Here we define a computed state variable, &lt;strong&gt;doubleCount&lt;/strong&gt;. It is important to note that the function is memoized by default and runs only when &lt;strong&gt;count&lt;/strong&gt; has changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&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;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// memoized function that only executed when count change&lt;/span&gt;
  &lt;span class="na"&gt;doubleCount&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="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;count&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt; you would have to write selectors and use libraries like &lt;a href="https://github.com/reduxjs/reselect"&gt;Reselect&lt;/a&gt; to memoize the calculation. But not in &lt;a href="https://overmindjs.org"&gt;Overmind&lt;/a&gt;, it's already included. SIMPLE, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  State mutation
&lt;/h3&gt;

&lt;p&gt;All state mutations are done with &lt;strong&gt;actions&lt;/strong&gt;. Actions have access to your state and can directly change properties.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;incCount&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="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;count&lt;/span&gt; &lt;span class="o"&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;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="c1"&gt;// hint: you get fully typed state and actions here&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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;three&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// TS Error: Should be number&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;resetCount&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="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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;setCount&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;value&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="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt; You can't mutate state outside the actions, this means you can't accidentally try to change them in your views.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is no spread madness like in &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt; that comes with &lt;strong&gt;immutability&lt;/strong&gt;. Just change what you want to change. SIMPLE, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  Side effects
&lt;/h3&gt;

&lt;p&gt;Effects allow you to decouple your app completely from 3rd party APIs. You can read more about them here: &lt;a href="https://overmindjs.org/guides/beginner/04_runningsideeffects?view=react&amp;amp;typescript=false"&gt;overmind effects&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;From the docs:&lt;/strong&gt; Developing applications is not only about managing state, but also managing side effects. A typical side effect would be an HTTP request or talking to localStorage. In Overmind we just call these effects. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Effects should be "initialized" in the onInitialize function of Overmind. There you can provide them with all stuff they need like getters for getting current state or actions to execute.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;onInitialize&lt;/span&gt; &lt;span class="o"&gt;=&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;effects&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;actions&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;effects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myCoolEffect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;getSomeState&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;partOfState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;onMoviesLoadSuccess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setMovies&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;h3&gt;
  
  
  Access state and actions in components
&lt;/h3&gt;

&lt;p&gt;To get state in a component you have to &lt;a href="https://overmindjs.org/guides/beginner/07_connectingcomponents?view=react&amp;amp;typescript=false"&gt;connect&lt;/a&gt; it to Overmind. This is done with the &lt;strong&gt;useOvermind&lt;/strong&gt; hook that provides state and actions. All you have to do is to deconstruct the hook result and you have all you need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;Counter&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="c1"&gt;// hint: you get fully typed state and actions here&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;incCount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useOvermind&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;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="na"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&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;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;incCount&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;INC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is all? Yes, it is nuts how easy it is to get state and actions into your components. But wait: How can we prevent the component from rerendering when other parts of the global state have changed, like the &lt;strong&gt;title&lt;/strong&gt;? Our component is only interested in the &lt;strong&gt;count&lt;/strong&gt; property and only wants to rerender if this value changes. &lt;br&gt;
Guess what: Overmind nows exactly which parts of the state the component is using and updates the component only when this part of the state changes. SIMPLE, right?&lt;/p&gt;
&lt;h3&gt;
  
  
  Mutation tracking
&lt;/h3&gt;

&lt;p&gt;Overmind is using mutation tracking instead of immutability, you can read more about this concept here: &lt;a href="https://itnext.io/updating-uis-value-comparison-vs-mutation-tracking-9f6fe912dd9a"&gt;immutability vs. mutation tracking&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Christian Alfoni:&lt;/strong&gt; How you detect the changes and update the UI should just work and be performant! With mutation tracking you put your faith in the system. It relieves you of the mental load of figuring out how components update, it just works and optimally so.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Powerfull devtools
&lt;/h3&gt;

&lt;p&gt;Overmind comes with very powerfull devtools. You can use the &lt;a href="https://marketplace.visualstudio.com/items?itemName=christianalfoni.overmind-devtools-vscode"&gt;VSCode extension&lt;/a&gt; or use the standalone version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx overmind-devtools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see all your state and derived state, it's even possible to change it directly inside the tool. You can also see all executed actions with their payload and what part of the state they changed. Sending an action? Sure, you can do this as well. &lt;/p&gt;

&lt;p&gt;The view of your app is just an implementation detail. You can write and execute your whole application logic without any views, just with the help of the devtools. This is amazing and SIMPLE, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  Functional programming style
&lt;/h3&gt;

&lt;p&gt;I'm a big fan of functional programming paradigms, that were introduced with React and became the default in the React world after the release of hooks. Overmind perfectly fits into this. You write only functions, there is no need for classes.&lt;br&gt;
When I had a look in MobX this was a big downside for me because all the examples use classes and I don't want to use classes anymore if possible.&lt;/p&gt;

&lt;p&gt;What about pure functions? Mhhh yes sure, Overmind actions are not as pure as regular reducers. In practice it's not a real downside to me because you can test your actions very easy anyway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Documentation and learning curve
&lt;/h3&gt;

&lt;p&gt;Overmind has a very good documentation. I read it, started to try it in my appliaction and after 3 hours I had refactored my whole app. &lt;br&gt;
The framework internals are hidden to the developer and the api is very simple and straight forward. There is no additional hidden stuff to learn like &lt;a href="https://github.com/reduxjs/reselect"&gt;reselect&lt;/a&gt;, &lt;a href="https://redux-saga.js.org/"&gt;redux-sagas&lt;/a&gt;, &lt;a href="https://github.com/reduxjs/redux-thunk"&gt;redux-thunk&lt;/a&gt; etc.&lt;/p&gt;

&lt;p&gt;Cool side note: this was super easy, I was very confident to do the changes because I used &lt;a href="https://testing-library.com/react"&gt;react-testing-library&lt;/a&gt;. The tests were testing the functionallity of the components without implementation details. I had to do only very little adjustments in test initialization.&lt;/p&gt;

&lt;p&gt;After few hours you should already feel very comfortable. Back in the days it took me weeks to wrap my head around Redux. I tried also MobX (while learning Overmind) and it is much harder to read through the docs and to understand all this &lt;strong&gt;observer&lt;/strong&gt; and &lt;strong&gt;observable&lt;/strong&gt; stuff if this is completly new to you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running examples
&lt;/h3&gt;

&lt;p&gt;Here you can see a working example on Codesandbox:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/overmind-todomvc-typescript-39h7y?fontsize=14"&gt;Codesandbox Example TypeScript&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;I'm so happy I found &lt;a href="https://overmindjs.org"&gt;Overmind&lt;/a&gt;, it makes really a lot of fun to use and it simplyfied my app completely. I hope this article can help to convince you to give it a try.&lt;/p&gt;

&lt;h4&gt;
  
  
  Useful Links
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://codesandbox.io/s/overmind-todomvc-typescript-39h7y?fontsize=14"&gt;Codesandbox Example TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.overmindjs.org/introduction?view=react&amp;amp;typescript=false"&gt;Overmind docs with great introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.overmindjs.org/videos?view=react&amp;amp;typescript=true"&gt;Videos of the creator Christian Alfoni himself &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://itnext.io/updating-uis-value-comparison-vs-mutation-tracking-9f6fe912dd9a"&gt;immutability vs. mutation tracking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cover image by &lt;a href="https://pixabay.com/de/users/moise_theodor-2099584/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=1216853"&gt;Theodor Moise&lt;/a&gt; on &lt;a href="https://pixabay.com/de/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=1216853"&gt;Pixabay&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

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