<?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: sajrashid</title>
    <description>The latest articles on DEV Community by sajrashid (@sajrashid).</description>
    <link>https://dev.to/sajrashid</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%2F660044%2F7e1cca0b-f378-4a9d-bde7-0c8ebc115e84.png</url>
      <title>DEV Community: sajrashid</title>
      <link>https://dev.to/sajrashid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sajrashid"/>
    <language>en</language>
    <item>
      <title>CSS Hover style all your buttons/links in one line</title>
      <dc:creator>sajrashid</dc:creator>
      <pubDate>Fri, 23 Jul 2021 02:02:49 +0000</pubDate>
      <link>https://dev.to/sajrashid/css-hover-style-all-you-re-buttons-links-succinctly-496e</link>
      <guid>https://dev.to/sajrashid/css-hover-style-all-you-re-buttons-links-succinctly-496e</guid>
      <description>&lt;p&gt;Let's add a few buttons&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"primary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;OK&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"secondary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Cancel&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt;  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"accent"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Delete&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add some styles&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.primary&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="no"&gt;steelblue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.secondary&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;
&lt;span class="nc"&gt;.accent&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;

&lt;span class="nc"&gt;.primary&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="no"&gt;blue&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;Nice, but how about this ?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;0.8&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;Great now we only need a single css class for all our buttons and our links, but, but but... opacity dims the element, so how do we make it brighter without dimming either the base or the hover?&lt;/p&gt;

&lt;p&gt;🥁 🥁 🥁 Enter the brightness filter&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1.75&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;🆒 CSS filters Cool, but often overlooked.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/sajrashid/embed/gOWGVJG?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;EDIT: As suggested in the comments it's not cool to do this everywhere &amp;amp; it's certainly not meant to be a direction to do so... read the comments below for more&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Creating a editable dynamic JSON table in React part 2</title>
      <dc:creator>sajrashid</dc:creator>
      <pubDate>Thu, 22 Jul 2021 01:12:19 +0000</pubDate>
      <link>https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-in-react-part-2-2em8</link>
      <guid>https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-in-react-part-2-2em8</guid>
      <description>&lt;h2&gt;
  
  
  Part 2
&lt;/h2&gt;

&lt;p&gt;This articles is part 2 of a series, part 1 is &lt;a href="https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-4686"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NB: We're using craco to help with our builds as we can use Tailwind to locally test our table&lt;/p&gt;

&lt;h3&gt;
  
  
  Clone this &lt;a href="https://github.com/sajrashid/React-Dynamic-Json-Table/tree/Boilerplate"&gt;branch&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;  git clone -b boilerplate &lt;a href="https://github.com/sajrashid/React-Dynamic-Json-Table/tree/boilerplate"&gt;https://github.com/sajrashid/React-Dynamic-Json-Table/tree/boilerplate&lt;/a&gt; &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install node modules&lt;br&gt;
&lt;code&gt; Yarn  &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run the app using &lt;br&gt;
&lt;code&gt; Yarn start &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You should see the homepage. Have a look around it's a modified boiler plate template built from create-react-app.&lt;/p&gt;

&lt;p&gt;Folder structure has been setup, &lt;code&gt; src/npm-component/react-dj-table&lt;/code&gt; is where the table will live, a Tests folder that replicates the same folder structure and some mock data.&lt;/p&gt;
&lt;h3&gt;
  
  
  A word about complex state
&lt;/h3&gt;

&lt;p&gt;Managing state using the &lt;code&gt;useState&lt;/code&gt; hook is fine for small components, for a component with complex state we need to utilise the &lt;code&gt;useReducer&lt;/code&gt; hook. &lt;/p&gt;

&lt;p&gt;Whenever state values change that depend on other states values, you're getting into the realms of managing complex state. For anyone that's tried reducers are a game changer.... redux anyone ?&lt;/p&gt;

&lt;p&gt;ℹ️ info- Did you know, under the covers &lt;code&gt;useState&lt;/code&gt; actually calls useReducer!&lt;/p&gt;
&lt;h3&gt;
  
  
  Setting up the reducer
&lt;/h3&gt;

&lt;p&gt;in the &lt;code&gt;src/npm-component/react-dj-table/reducers&lt;/code&gt; folder&lt;/p&gt;

&lt;p&gt;create a &lt;code&gt;tablereducer.js&lt;/code&gt; &amp;amp; &lt;code&gt;actions.js&lt;/code&gt; file&lt;/p&gt;

&lt;p&gt;add the following code to &lt;code&gt;actions.js&lt;/code&gt;&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ACTIONS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="na"&gt;TESTSTATE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;teststate&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;p&gt;and to &lt;code&gt;tablereducer.js&lt;/code&gt;&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="k"&gt;import&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="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./actions&lt;/span&gt;&lt;span class="dl"&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;TableReducer&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;action&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="k"&gt;switch&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="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nx"&gt;ACTIONS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;TESTSTATE&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;testValue&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nl"&gt;default&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;state&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;So far we have set-up the reducer, with a single ACTION, that increments a value and save that value to state, pretty straight-forward.&lt;/p&gt;

&lt;p&gt;in the &lt;code&gt;react-dj-table&lt;/code&gt; folder create a file called &lt;code&gt;table.js&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Here we need to set-up initial state and the reducers dispatch function.&lt;/p&gt;

&lt;p&gt;add the following code to &lt;code&gt;table.js&lt;/code&gt;&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="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;useReducer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;TableReducer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../react-dj-table/reducers/tablereducer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Table&lt;/span&gt; &lt;span class="o"&gt;=&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;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;testValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&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="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TableReducer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Table&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;take a moment to digest the above code, self explanatory so far hopefully.&lt;/p&gt;

&lt;p&gt;..... ready ? , it's time to call the reducer via dispatch&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;type&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;TESTSTATE&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to call the reducer and supply the Action name from the actions file, we don't need to use defined actions &amp;amp; they don't need to be called action either. It's just a conventions &amp;amp; preferences thing. &lt;/p&gt;

&lt;p&gt;ℹ️ Tip - It does help while learning as you'll get less typo's.&lt;/p&gt;

&lt;p&gt;Update our &lt;code&gt;table.js&lt;/code&gt; file&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="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;useReducer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&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="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../react-dj-table/reducers/actions&lt;/span&gt;&lt;span class="dl"&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;TableReducer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../react-dj-table/reducers/tablereducer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Table&lt;/span&gt; &lt;span class="o"&gt;=&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;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;testValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&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="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TableReducer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;initialState&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;buttonClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;type&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;TESTSTATE&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;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;buttonClick&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;Increment&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="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;testValue&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;/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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Table&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have a added a button with a click funtion that calls the reducers dispatch functions passing in an action.&lt;/p&gt;

&lt;p&gt;Add the table (ok, it's not really a table but we can pretend for testing purposes) to the &lt;code&gt;src/pages/home.js&lt;/code&gt; page&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Table&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;../npm-component/react-dj-table/table&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Home&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;div&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;flex justify-center w-full h-full mt-4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Table&lt;/span&gt; &lt;span class="o"&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Go to your page click the increment button.&lt;/p&gt;

&lt;p&gt;Awesome we have a working reducer!!!&lt;/p&gt;

&lt;p&gt;🤓🤓🤓&lt;/p&gt;

&lt;p&gt;In the next part we're going to add some data, build our rows, cells and perhaps add a sort. Then maybe accelerate the pace ? &lt;/p&gt;

&lt;p&gt;The completed code is in &lt;a href="https://github.com/sajrashid/React-Dynamic-Json-Table/tree/part2"&gt;part2 branch&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;⭐⭐⭐ The repo &lt;a href="https://github.com/sajrashid/React-Dynamic-Json-Table"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-dj-table.netlify.app/about/"&gt;Demo site&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;✌️✌️✌️ Talk to you in part 3, bye for now.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is Given, When Then in agile stories &amp; why ?</title>
      <dc:creator>sajrashid</dc:creator>
      <pubDate>Wed, 21 Jul 2021 18:40:25 +0000</pubDate>
      <link>https://dev.to/sajrashid/what-is-given-when-then-in-agile-stories-why-2758</link>
      <guid>https://dev.to/sajrashid/what-is-given-when-then-in-agile-stories-why-2758</guid>
      <description>&lt;h2&gt;
  
  
  Why do we use given, when then
&lt;/h2&gt;

&lt;p&gt;You might be surprised how many engineers, scrum masters and general agile people use given when then, in some form or another, but may not be able to clearly explain why.&lt;/p&gt;

&lt;p&gt;A simple user story&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Given that I am a user, When I click the update button, Then the button should turn green.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Some may say it makes stories easy to understand, that would be true, but lot's of language styles can do that, so why ?&lt;/p&gt;

&lt;p&gt;Ask around ? let us know in the comments&lt;/p&gt;

&lt;h3&gt;
  
  
  First clue
&lt;/h3&gt;

&lt;p&gt;Given&lt;br&gt;
When&lt;br&gt;
Then&lt;/p&gt;

&lt;p&gt;We have three items, where else do we have a similar conceptual flow ?&lt;/p&gt;

&lt;p&gt;If you've twigged it already, you're a genius, (yeah I didn't either)&lt;/p&gt;

&lt;h3&gt;
  
  
  Second clue..
&lt;/h3&gt;

&lt;p&gt;Arrange&lt;br&gt;
Act&lt;br&gt;
Assert&lt;/p&gt;

&lt;p&gt;Anyone ?&lt;/p&gt;

&lt;h3&gt;
  
  
  Map the story to the test
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Story&lt;/th&gt;
&lt;th&gt;Test&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Given, that I am user&lt;/td&gt;
&lt;td&gt;Arrange, test in the context of a user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;When, I click the update button&lt;/td&gt;
&lt;td&gt;Act, create button click test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Then, the button should turn green.&lt;/td&gt;
&lt;td&gt;Assert, the button colour is actually green&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;See how the story maps to the test, it makes it crystal clear what the ask is, bearing in mind it's not acceptance criteria it should stay high level.&lt;/p&gt;

&lt;p&gt;The developers &amp;amp; the testers are able to break the story down relatively precisely into tasks.&lt;/p&gt;

&lt;p&gt;Hopefully you now understand the all encompassing why, at least as far as given when them goes anyway 😮😮😮.  &lt;/p&gt;

&lt;p&gt;🤚 Bye for now. &lt;/p&gt;

&lt;p&gt;&lt;sup&gt;Drop me some feedback please, helps decide what to write about next!&lt;/sup&gt;&lt;/p&gt;

</description>
      <category>agile</category>
      <category>testing</category>
      <category>programming</category>
    </item>
    <item>
      <title>Creating a editable dynamic JSON table in React</title>
      <dc:creator>sajrashid</dc:creator>
      <pubDate>Wed, 21 Jul 2021 04:26:54 +0000</pubDate>
      <link>https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-4686</link>
      <guid>https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-4686</guid>
      <description>&lt;p&gt;&lt;sup&gt;This articles is part of a series, part 2 is &lt;a href="https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-in-react-part-2-2em8"&gt;here&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;A couple of years ago I created a dynamic JSON table, I always wanted to make it editable, yeah I can hear what your thinking..&lt;br&gt;
So mid pandemic I get laid off. Great new jobs are at all time low.&lt;/p&gt;

&lt;p&gt;While I'm on the hunt for a new role, wouldn't it be great to do that project I've had in the back of my mind .. hmmm.&lt;/p&gt;

&lt;p&gt;Don't get me wrong, there a lot's of great tables out there, some need a tonne of boiler plate code other just don't have some of most basic feature you might expect.&lt;/p&gt;

&lt;p&gt;So why not make one, tables are easy or should be, try adding sorting, filtering, paging and then make it editable, it's quite a challenge.&lt;/p&gt;

&lt;p&gt;What I'd like to know is how many of you would be interested in a fairly detailed breakdown. I think it might be hard going for newcomers but for mid level developers, it could be good ?&lt;/p&gt;

&lt;h2&gt;
  
  
  So what would we cover
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;General overview (initial project setup)&lt;/li&gt;
&lt;li&gt;Reflection, Dynamic types, efficient inferring&lt;/li&gt;
&lt;li&gt;Managing complex state&lt;/li&gt;
&lt;li&gt;Detailed guide on how to use the reducer hook&lt;/li&gt;
&lt;li&gt;CRUD operations&lt;/li&gt;
&lt;li&gt;Jest - Testing Coverage, Unit, Snapshot&lt;/li&gt;
&lt;li&gt;NPM Publishing&lt;/li&gt;
&lt;li&gt;anything else you might want&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Take a look at the &lt;a href="https://react-dj-table.netlify.app/"&gt;demo's and examples&lt;/a&gt;, &lt;a href="https://github.com/sajrashid/React-Dynamic-Json-Table"&gt;source&lt;/a&gt;,  drop me some feedback &amp;amp; I'm ready to write a series.&lt;/p&gt;

&lt;p&gt;Bye for now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;So the ask is to create an editable JSON table, what else?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;CSS agnostic, must be style-able with any library&lt;/li&gt;
&lt;li&gt;Output a ‘proper’ semantically correct HTML table&lt;/li&gt;
&lt;li&gt;Recognise and display correct types (bools, numbers, dates, strings)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Warning spec's ahead 🤨🤨🤨&lt;/p&gt;

&lt;h3&gt;
  
  
  Developer defined options
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Row Selection – return selected row&lt;/li&gt;
&lt;li&gt;Identity columns &lt;/li&gt;
&lt;li&gt;Label columns – custom columns names &lt;/li&gt;
&lt;li&gt;Icon columns – display font or SVG icons in the table headers &lt;/li&gt;
&lt;li&gt;Hide columns &lt;/li&gt;
&lt;li&gt;Date columns – configurable date formats with localisation&lt;/li&gt;
&lt;li&gt;Custom column cells – HTML/CSS, support images
&lt;/li&gt;
&lt;li&gt;Checkbox columns , show bools as checkboxes as default, or as 
string value, optionally&lt;/li&gt;
&lt;li&gt;Footer – display messages and any HTML/CSS&lt;/li&gt;
&lt;li&gt;Sortable &lt;/li&gt;
&lt;li&gt;Pageable, client side pagination (for now)&lt;/li&gt;
&lt;li&gt;Filtering, basic if possible advance search&lt;/li&gt;
&lt;li&gt;Edit – smart pager, intuitive buttons, must guide the user&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Phase 2 Developer defined options
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Custom pagination&lt;/li&gt;
&lt;li&gt;Custom editor buttons&lt;/li&gt;
&lt;li&gt;Support for external filters on any column&lt;/li&gt;
&lt;li&gt;Server side paging&lt;/li&gt;
&lt;li&gt;Expose dispatch, call reducer actions&lt;/li&gt;
&lt;li&gt;Expose state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Much of phase 2 is available such as exposing dispatch&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 3 Plugins TBD
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add support for developer defined components and libraries, date pickers, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Phase 3 is in a very early R&amp;amp;D state&lt;/p&gt;

&lt;p&gt;now that we have the boring part out of way time to write some code...&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;This articles is part of a series, part 2 is &lt;a href="https://dev.to/sajrashid/creating-a-editable-dynamic-json-table-in-react-part-2-2em8"&gt;here&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;👊👊👊&lt;/p&gt;

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