<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Francis Ali on Medium]]></title>
        <description><![CDATA[Stories by Francis Ali on Medium]]></description>
        <link>https://medium.com/@sixfwa?source=rss-acdde6cbd525------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lWYB7F-8yzPFnFhgp0Cz_w@2x.jpeg</url>
            <title>Stories by Francis Ali on Medium</title>
            <link>https://medium.com/@sixfwa?source=rss-acdde6cbd525------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:19:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sixfwa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Professional Growth at Alasco]]></title>
            <link>https://medium.com/alasco-tech/professional-growth-at-alasco-30e81a957e1d?source=rss-acdde6cbd525------2</link>
            <guid isPermaLink="false">https://medium.com/p/30e81a957e1d</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[startup-lessons]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[professional-development]]></category>
            <dc:creator><![CDATA[Francis Ali]]></dc:creator>
            <pubDate>Fri, 28 May 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-05-28T08:57:40.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YivBrILTk6cQgCIa.jpg" /></figure><p>My career as a software engineer really began the moment I walked through the glass doors of the Alasco office building. As I didn’t know what to expect, a multitude of questions were racing through my head. To two prominent ones, which kept coming back to me were:</p><ul><li>How will I grow as a professional?</li><li>What will I learn?</li></ul><p>Nine months on I feel as if I can start to address them. Which ladies and gentlemen, is what I will be doing in this article, through the use of a few salient points that I have compiled.</p><h3>Closed mouths don’t get fed</h3><p>It’s important to keep in mind that the service being developed at Alasco is targeted towards those that work in property development. If you are like me, then jumping into a startup that operates in such a space may be a bit of a challenge. There are a lot of fancy words and processes to come to terms with, which may be <em>slightly</em> harder if you have little to no knowledge of the German language.</p><p>Fortunately, as everyone speaks English at Alasco, coming to terms with the domain language can be as simple as “ask and someone will explain”. The question then is, “who should you ask?”.</p><p>It’s usually the case for software engineers, that we don’t deal with customers on a daily basis. As a result, there will be times where we may need a further understanding of the reasons <em>why</em> a feature is to be developed and designed in a certain way.</p><p>When faced with such questions, it’s helpful to seek those who have a deeper understanding of what it’s like to step into the shoes of a customer. There are many at Alasco who know what that’s like, such as those in Product and Customer Success, and during my time at the company they have been the best to approach.</p><h3>It’s more than just the code you write</h3><p>One of the many great things at Alasco is that you’re not constrained to the role of software engineer. Sure, you write and maintain code or infrastructure more than anything else, but it doesn’t end there. Even as a backend engineer you can opt in for working on the frontend or vice-versa.</p><p>Many opportunities arise where you can go beyond the code you write. For example, at the end of a sprint, each team goes onto presenting the features / fixes that have been made throughout the past two weeks. The same can also be said about sprint retrospectives, where an engineer usually takes the lead of setting up and moderating it.</p><p>For those of you who enjoy putting pen to paper (more so fingers to keys), there is also the <a href="http://alasco.tech/">alasco.tech</a> blog. Where once a month an engineer or someone from Product go about writing and publishing a post.</p><p>To sum up, not only do you improve as an engineer in regards to programming etc, you also get the chance to enhance skills such as communication, moderation and writing.</p><h3>Development on a large Budget</h3><p>It’s a fact that the profession of software engineering is developing at an insane rate. There’s always some new framework or language that’s trending on HackerNews or Reddit, which can at times feel as if there is too much to learn.</p><p>Aside from the software industry, there may be other skillsets you may want to improve or learn. Whether that be picking up a new language (e.g. German), furthering leadership skills or wanting an insight into areas such as design or product management.</p><p>Luckily Alasco has an annual budget of €2.000 for every full-time employee at the company along with 3 days of the year for personal development. One can use this for conferences, seminars, books or courses. For example if you are someone who works as a frontend engineer and want to better understand the backend stack, then you can use the budget to take courses or attend conferences.</p><p>I started Alasco as a junior backend engineer and looking back there has been a lot that has started to shape me as a professional. More importantly however there still so much potential growth in the near future.</p><p>If you clicked and read this article in hopes of gaining an insight into personal development at Alasco, I hope this article fulfilled that curiosity.</p><p><em>Originally published at </em><a href="https://alasco.tech/2021/05/28/personal-development-at-alasco.html"><em>https://alasco.tech</em></a><em> on May 28, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30e81a957e1d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/alasco-tech/professional-growth-at-alasco-30e81a957e1d">Professional Growth at Alasco</a> was originally published in <a href="https://medium.com/alasco-tech">Alasco Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Division of Labour]]></title>
            <link>https://sixfwa.medium.com/the-division-of-labour-96ef17ac9056?source=rss-acdde6cbd525------2</link>
            <guid isPermaLink="false">https://medium.com/p/96ef17ac9056</guid>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[industry]]></category>
            <category><![CDATA[capitalism]]></category>
            <category><![CDATA[history]]></category>
            <category><![CDATA[philosophy]]></category>
            <dc:creator><![CDATA[Francis Ali]]></dc:creator>
            <pubDate>Thu, 17 Dec 2020 17:03:38 GMT</pubDate>
            <atom:updated>2020-12-17T17:03:38.268Z</atom:updated>
            <content:encoded><![CDATA[<h4>Adam Smith — Chapter I Breakdown</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LYbTKpefHEiytnkZ.jpeg" /></figure><h3>Why I am reading <strong>The Wealth of Nations</strong></h3><p>For some time now I have been reading books which go over different schools of economics, and how each one takes a look at a governments role in a market and the liberties given to an individual. However every book I picked up always made some reference to the <strong>The Wealth of Nations (TWON) by Adam Smith</strong>.</p><p>I had known of the book, however was somewhat discouraged to read it due to it’s 18th Century use of the English language. Now however, it has come to the point where enough is enough. Book after book mentions <strong>TWON</strong>, so instead of getting a limited understanding of the book via second hand information, I may as well read the bloody book myself (and also understand it properly).</p><p>Which brings me to the first chapter: <strong>On the Division of Labour</strong>.</p><h3>On the Division of Labour</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fraG1Q0sa8bj9pkZ" /></figure><p>Smith opens up by stating that “the greatest improvements in the productive powers of labour” is the division of labour, but what does that mean? Luckily Smith is a big fan of explaining through examples, and for this particular one he begins with that of a pin-maker.</p><p>Now it is safe to assume that not everyone has the knowledge to make an entire pin. As a result “one who is not educated to the business, and not acquainted with the machinery employed to make pins” could only make one pin a day.</p><p>What Smith proposes is that the manufacturing process of making a pin should be divided into a number of branches. Instead of one person making an entire pin, the process can be broken up into different stages. Where a person only focuses on one or two stages, and has no interest in the others. For example:</p><ul><li>one person draws out the wire</li><li>another straightens it</li><li>a third cuts it</li><li>a fourth points it</li><li>etc…</li></ul><p>Overtime each worker becomes much more acquainted with the tools they need to use in order to complete their tasks.</p><p><strong>It gets juicier</strong></p><p>From Smith’s observations, he has seen a manufacturing firm consisting of 10 workers perform two or three distinct operations. Although each were indifferently accommodated with the necessary machinery, they could among themselves make about 48,000 pins a day.</p><p>Therefore, each person might be considered as making 4800 pins in a day. On the other hand, had each of them wrought separately and independently, and without any of them being educated to the business, they certainly could not have made 20 pins each.</p><h3>Agriculture vs Manufacturing</h3><p>There are of course forms of labour which cannot be easily subdivided. One example being <strong>agriculture</strong>.</p><blockquote><em>the spinner is almost always a distinct person from the weaver; but the ploughman, the harrower, the sower of the seed, and the reaper of the corn, are often the same.</em></blockquote><p>Smith opines that one of the reasons why an industry such as agriculture does not keep up to date with manufacturing, is that agricultural work cannot be easily subdivided as work found in manufacturing. As a result agricultural work is much more inefficient hence output being a lot slower.</p><h3>Three Ways to Increase the Quantity of Production</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d1L_r3FzVnzlS46B" /></figure><p>From Smith’s view the division of labour improves productivity in three ways. He writes:</p><ol><li><em>To the increase of dexterity in every particular workman</em></li><li><em>To the saving of time which is commonly lost in passing from one species of work to another</em></li><li><em>To the invention of a great number of machines which facilitate and abridge labour, enabling one worker to do the work of many</em></li></ol><h4><strong>To the increase of dexterity in every particular workman</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fnpACHere-z8ejlt" /></figure><p>Here, Smith argues that people in more specialised jobs naturally become more skilled and efficient at performing their work. Therefore one should reduce a worker’s business to some simple operation. Through repetition they will become more familiar with the tools, hence faster.</p><p>The example given is that of a blacksmith, who though accustomed to handle the hammer and has never made nails, if upon some occasion he is obliged to attempt it, will most likely make two or three hundred bad ones. Therefore it is important to provide the blacksmith with work which requires the hammer.</p><h4>To saving time which is commonly lost in passing from one species of work to another</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*52hglWqluWNjRbGR" /></figure><p>When a worker is switching from one task to another means that there is a loss of time. This cost Smith says is widely underestimated.</p><blockquote><em>It is impossible to pass very quickly from one kind of work to another that is carried out in a different place and with quite different tools.</em></blockquote><p>What was of great interest to me, is how Smith takes into account the psychology of someone at work. When a worker first begins new work, they are seldom “very keen and hearty”. Therefore in most cases they spend their time unfocused rather than applying good purpose. Changing your hand in twenty different ways throughout the whole day, renders a worker almost always slothful and lazy, “and incapable of any vigorous application even on the most pressing occasions.</p><blockquote><em>The habit of sauntering and of indolent careless application, which is naturally, or rather necessarily acquired by every country workman who is obliged to change his work and his tools every half hour, and to apply his hand in twenty different ways almost every day of his life, renders him almost always slothful and lazy, and incapable of any vigorous application even on the most pressing occasions.</em></blockquote><h4>To the invention of a great number of machines which facilitate and abridge labour, enabling one worker to do the work of many</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Yei2m0I-T3zvXX2d" /></figure><p>Even advancements in technology can be attributed to the division of labour, since the more specialised a person’s work is, the more likely they are to discover a mechanical or even an automatic way of doing the work.</p><p>Smith states that we are much more likely to discover easier and readier methods of attaining any object when the whole of our attention is directed towards that single object, than when it is dissipated among a great variety of things.</p><blockquote><em>A great part of the machines made use of in those manufactures in which labour is most subdivided, were originally the inventions of common workmen, who, being each of them employed in some very simple operation, naturally turned their thoughts towards finding out easier and readier methods of performing it.</em></blockquote><h3>The Division of Labour — philosophers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sT1KxxF225QX3Gsa" /></figure><p>Towards the end of the chapter Smith moves away from describing the division of labour when it comes to manufacturing, and instead towards the industry of philosophy.</p><p>He states that even a domain such as philosophy can be subdivided into a great number of branches, each of which affords occupation to a peculiar class of philosophers. This subdivision of philosophy improves dexterity and saves time. As a result each individual becomes more expert in their own branch, more work is done upon the whole, and the quantity of science is considerably increased by it.</p><h3>End Note</h3><p>It is important to take into account what era Adam Smith wrote <strong>The Wealth of Nations</strong> (1776), as a lot may not apply in today’s world. Having said that I plan to publish a modern take on this chapter for my next post.</p><p>If you enjoyed this post feel free to subscribe to me on <a href="https://sixfwa.substack.com/">Substack</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96ef17ac9056" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Day in the Life of a Software Engineer at Alasco]]></title>
            <link>https://medium.com/alasco-tech/a-day-in-the-life-of-a-software-engineer-at-alasco-ec23993264d4?source=rss-acdde6cbd525------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec23993264d4</guid>
            <category><![CDATA[startup-life]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[day-in-the-life]]></category>
            <category><![CDATA[munich]]></category>
            <dc:creator><![CDATA[Francis Ali]]></dc:creator>
            <pubDate>Fri, 30 Oct 2020 00:00:00 GMT</pubDate>
            <atom:updated>2020-11-02T08:56:29.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w5GohEcWd2I4vZK6.jpg" /></figure><p>Before we begin, I think it would be quite nice for me to give a quick introduction. At the time of writing, I have been working at Alasco for nearly 3 months as a full-time software engineer. I came from the United Kingdom right after finishing my studies in Birmingham, and I am now a member of the Alasco engineering team, PCF. Being a member of team PCF means that we work to improve all processes that deal with the planning, controlling and forecasting of construction costs, hence the name.</p><p>In my position as an Engineer at Alasco, I am part of creating a SaaS (Software as a Service) tool built to both digitalize and disrupt the construction industry. Writing about a ‘typical’ day at Alasco is quite a challenge, therefore a couple of points have been highlighted about this post.</p><p>Given that Alasco is a startup, brings me to my first point. Being a startup naturally means that the idea of an “average” day is thrown out of the window, the days (and even weeks) are pretty inconsistent, therefore hard to generalize.</p><p>The second point is that as a software engineer, where your daily work involves developing a product that could potentially be used by 1000+ people within the construction industry, one cannot have a “typical” day. As each day comes with its own set of challenges.</p><h3>A Day in the Life</h3><p>As stated earlier, there is no real typical day, but I will try to give you an overview of what might entail on the job in a single day. We will also be focusing on office life, rather than the working from home one, given that COVID-19 has pushed many of us to do the latter.</p><h3>Morning</h3><p>Alasco maintains a rather flexible working schedule, meaning that there is no well defined start time or home time. Engineers tend to be in the office between 09:00 and 09:45, in time for the daily stand-up conducted at 10:00 for each of the two agile teams, (teams PCF and Process). Here, all members have to answer the following questions:</p><ul><li>What did you achieve yesterday?</li><li>What do you plan on achieving today?</li><li>Is anything blocking you?</li></ul><p>Daily stand-ups occur every morning and usually last between 10–15 minutes. Once that is finished, emails are checked and coffee is drunk. I guess in most professions coffee is vital in getting any meaningful work done, this is definitely the case as a developer. Once a decent amount of caffeine is swimming in our bloodstreams, the programming begins.</p><p>However on some mornings, there are more meetings than usual. To list a few:</p><ul><li>Weekly Kickoff — where all employees are given the latest updates within the company. Such as; new hires, company strategy and goals.</li><li>Product review — where both engineering teams present their latest features to the rest of the company.</li><li>Retro — as you may have guessed from the terminology used earlier, teams at Alasco are agile, hence sprint based. Which means that every two weeks we have to, as a team, break down what needs to be done in the upcoming sprint.</li></ul><h3>Afternoon</h3><p>What marks the start of the afternoon and lunch is a message on Slack reading “lunch plans?”. From there, all colleagues with the objective of eating out, cluster into small groups, each with a food place in mind. Due to COVID-19 we can’t make use of the kitchen, fortunately however Leopoldstraße, where the Alasco office is located, has an abundance of food choices.</p><p>Typical food choices are usually:</p><ul><li>Lebanese</li><li>Salad Bowls</li><li>Döner</li></ul><p>Once everyone’s had their fill, it’s back to work. Each developer is usually working on a story (such as a feature) or on bug fixes. This is done either on one’s own or in pairs. Once a story has reached completion, a pull request is made for other developers to review and any visible changes are assessed by the Product Owner. If everything has been approved and well tested, the story is then deployed to production.</p><p>All in all, the afternoon is very much like the morning, just a few hours longer. Some afternoons can have more meetings than others, however one which takes place everyday is the daily check-in, which is a reflection of the morning stand-up. This is where each team member re-evaluates the question, <em>what do you plan on achieving today?</em>.</p><p>On the other hand, if it’s not an afternoon meeting, it’s back to furthering the progress of new features or bug fixes. All this of course is made possible by our good friend <em>Coffee</em>. Who without, would make coding tasks much more strenuous. Having said this, the end of the day is usually signaled when caffeine no longer works as fuel for the mind, hence making problems that would have seemed easy in the morning, 10x harder.</p><p>As there is no fixed time to mark the end of the day, most employees leave around 18:00 and 18:30. Of course depending on the circumstances, whether they be personal or professional.</p><h3>Evening</h3><p>Back when it was safer to have a large group together, there was more of a social life at Alasco, typically on Friday evenings. An example of us coming together is where we would have drinks and catch-up with colleagues that we had missed during the week.</p><p>So this more or less wraps up what a day in the life of a software engineer at Alasco looks like. Although not every software engineer spends their day life this, we do hope that this gives you a pretty rough idea on how a day goes by as a developer at Alasco.</p><p><em>Originally published at </em><a href="https://alasco.tech/2020/10/30/a-day-in-the-life-of-a-software-engineer-at-alasco.html"><em>https://alasco.tech</em></a><em> on October 30, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec23993264d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/alasco-tech/a-day-in-the-life-of-a-software-engineer-at-alasco-ec23993264d4">A Day in the Life of a Software Engineer at Alasco</a> was originally published in <a href="https://medium.com/alasco-tech">Alasco Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple React Application]]></title>
            <link>https://sixfwa.medium.com/building-a-simple-react-application-bcaa3f2d3576?source=rss-acdde6cbd525------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcaa3f2d3576</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Francis Ali]]></dc:creator>
            <pubDate>Mon, 18 May 2020 15:54:35 GMT</pubDate>
            <atom:updated>2020-05-18T19:08:26.563Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIgSjY_CeMINi-joTZWzmg.jpeg" /><figcaption>LET’S GOOOOO</figcaption></figure><p>Before we wander off into the world that is ReactJS, I just want to let you guys know that this is my first blog post. So the fact that you’re reading this means the world. As this is my first post I thought it would be best to start with my favourite frontend library, ReactJS. Whether you are a beginner or just someone that wants to build a very simple React application, then this is the blog post for you.</p><h3>What we’re going to build</h3><p>For this tutorial, we will be developing a very basic React application, where a user will be able to input a value which will be used to increment or decrement a current count. Basically, an extremely simple calculator that can only perform addition and subtraction. We won’t just be going over ReactJS but also some CSS!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XZTQtODL47HK1IhiPx1B-A.png" /><figcaption>Screenshot of what we will be developing</figcaption></figure><blockquote>The source code for this tutorial can be found on my <a href="https://github.com/sixfwa/react-project-1">GitHub</a></blockquote><p>This tutorial will not be going over the nitty-gritty details of React. Instead, we’re just going to go head first into development, with little bits of information along the way.</p><h3>Setting up the React App</h3><p>I am going to go with the assumption that you already have <em>create-react-app</em> and <em>npx</em> installed. If not, then at the bottom of this page you’ll find a link that should help with the installation process.</p><p>To start with, jump into the terminal and <em>cd</em> into your preferred directory. Then enter the following and hit Enter.</p><figure><img alt="npx create-react-app ." src="https://cdn-images-1.medium.com/max/514/1*9x7Ls-H4X-f21_MIImlfYQ.png" /><figcaption>npx create-react-app .</figcaption></figure><p>This command will set up your development environment where you will be able to start building the React application. One of the great things about <em>create-react-app </em>is that you don’t need to install or configure tools such as webpack or Babel, but instead focus on the code.</p><p>The “.” in the above snippet means that a React application will be generated and named after the directory you are currently in. Now, to ensure that everything has been installed properly. Run the command shown below:</p><figure><img alt="npm start" src="https://cdn-images-1.medium.com/max/296/1*vEBN6jNDfzdJrKHBSaQ8_A.png" /></figure><p>If setup was successful your browser will open up on <a href="http://localhost:3000/">http<em>://localhost:3000</em></a>/ displaying the React logo along with some content.</p><h3>Building in React</h3><p>Now that we have the boilerplate code, we can start building the application. The first thing to do is to open up your favourite text editor (VSCode is the best) and then the directory containing the React application. From there, navigate to the <em>App.js </em>file. This file contains the <em>App </em>component which acts as the container for all other components.</p><p>Remove all the necessary lines of code until your <em>App.js </em>file looks like the one shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*RAxZYJT6Oq9eMx9L_waaZw.png" /><figcaption>App.js</figcaption></figure><p>We have removed the imports and styles and also emptied the body of the <em>return </em>statement and added a <em>&lt;h1&gt; </em>tag which will display the name of the application. Standard HTML stuff.</p><p>Now we can move onto creating the core part of the application. Within your <em>src </em>folder, create a new directory called <em>components</em>. Within that folder create a file called <em>Counter.js</em> and add the boiler plate code for the component as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*FbnqvL2aHY2e66ePzk-d7g.png" /><figcaption>components/Counter.js</figcaption></figure><p>Within the <em>return</em> statement, we have the mandatory div tag to encapsulate the rest of the component. We added an input field that can only receive a number, which is done by specifying <em>type</em> as <em>“number”</em>. We also added a <em>placeholder</em> to give users a bit of guidance on what to enter.</p><p>Then we have the two buttons, “-” and “+”. We will add functionality in the next step, where the “-” button will decrement the <em>count</em> by the <em>value</em> specified in the input field, whereas the “+” button will increment the <em>count</em> by said amount.</p><p>You’re probably wondering why there is a &lt;div&gt; between the two buttons. This will later be used to show the current count which will be set up in the next step.</p><h4>Adding Functionality</h4><p>Now it would be a pretty boring app if it didn’t do anything apart from look the part. In this section we will add functionality so that the app can increment and decrement a <em>count</em> by a given <em>value</em>. We will add the following lines shown in colour in the snippet below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*rYtpdOlYpuZeL5ScdAEJ5A.png" /><figcaption>component/Counter.js</figcaption></figure><p>To start with, we import the React hook <em>useState</em>, which will allow us to have a state variable in our functional component <em>Counter</em>. To make use of this we write the line shown opposite, containing the <em>const [count, setCount].</em></p><p>n English, what this line means is that we want to have a count which we will initially set to 0. Therefore, every time the application has mounted, the count will be set to 0. We are also telling the system that we want a function <em>setCount</em> which will allow us to change the value of <em>count</em>. The <em>count</em> has also been added, which is shown within the <em>&lt;div&gt;</em> tag.</p><p>Similar to what we did with <em>[count. setCount]</em>, we will do the same for <em>[value, setValue]</em>. <em>Value</em> is initialised to the value 1 and will be used to increment or decrement the <em>count</em>. The code is shown in the snippet below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*K91B1M6BDUj948RPGWW5EA.png" /><figcaption>component/Counter.js</figcaption></figure><p>Now that we have set up the two states required for this component, it’s time that we put them to use. To start with, we want the <em>value</em> to be set to whatever the user enters in the input field. This is done shown in the code below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*Z-6rsOzw9GGY1KzOxOJsHg.png" /><figcaption>components/Counter.js</figcaption></figure><p>As you can see, we have modified the <em>&lt;input&gt; </em>tag so that it now holds the attribute <em>onChange</em>. This attribute refers to a callback function which takes <em>e </em>(<em>event</em>) as a parameter.</p><p>In plain English, this callback function is telling the system that it must set the state of <em>value </em>to the number that has been entered. The <em>value </em>variable is then set using <em>setValue</em>.</p><p>As the input value is a string, we will use the <em>parseInt()</em> function to convert the value into an integer. Without this function, we would not be able to perform addition properly, as it would instead be concatenating the value. The parameter passed into <em>parseInt </em>is as follows:</p><pre>setValue(parseInt(e.target.value || 0));</pre><p>This is telling the React application to set the state of <em>value </em>to whatever number that is currently in the input field. However if a no number exists, then set the state of <em>value </em>to 0. This is to ensure that <em>value </em>is never set to <em>NaN</em>.</p><h4>Increment and Decrement</h4><p>As stated earlier, we want the “-” button to decrement the <em>count</em> by the <em>value</em> and the “+” button to increment the <em>count</em>. As we have the <em>setCount</em> function, implementing this feature is quite straight forward and is shown in the code snippet below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_4TqMklppc3mSnoSs-HRg.png" /><figcaption>components/Counter.js</figcaption></figure><p>We have modified the two buttons so that they now include the property <em>onClick</em>. For <em>onClick</em> we pass in a callback function which points to <em>setCount</em>. For the “-” button, it is telling the system that when someone clicks this button, it wants it to call the <em>setCount</em> method which will subtract the <em>value</em> from the current <em>count</em>. Similarly for the “+” button, but instead perform addition.</p><p>In terms of functionality, that’s the Counter component done. To see that it is working properly we need to import it and then implement it into App.js. The lines added are shown in green in the code snippet below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*gEE9fH6fLBCt2tvU_49YCA.png" /><figcaption>App.js</figcaption></figure><p>All we have done is imported the <em>Counter </em>into <em>App.js </em>and then placed it just below our <em>&lt;h1&gt; </em>tag.</p><p>Okay, that’s the React side done. Now it’s time to focus on styling the app, as right now it’s pretty bland.</p><h3>Styling the App</h3><p>Let’s first start by giving the background some colour. Jump into the <em>index.css</em> file and within the body section add the line shown at the bottom of this snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJ3E9DKeCFonBAtesMynFw.png" /><figcaption>index.css</figcaption></figure><p>For those that are not so familiar with CSS, what we are doing here is just setting the background colour to wheat.</p><pre>background-color: wheat;</pre><p>When it comes to styling in ReactJS, there are a couple of ways in which we can do this. For this tutorial, we will cover two different methods. The first one is to create a corresponding CSS file to <em>Counter.js</em>.</p><p>In the components directory, create a file called <em>counter.css</em>, which will contain the styles for the Counter component. Before writing these styles we first need to add the class names within Counter. These will be used as reference points for<em> counter.css</em> so that it knows what areas to target. The code snippet below will show what changes need to be made in <em>Component.js</em>, where the changes are shown in green.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*I9XS9-Bjd_Y0JthYL25YHQ.png" /><figcaption>components/Counter.js</figcaption></figure><p>First, we import the CSS file we have created for the <em>Counter</em> component, which will now allow us to style the component from within <em>counter.css</em>. Next we add all the relevant class names, with the first one being <em>container</em>. This will act as a box that will contain the input field, the counter display and the two buttons. Then we add the class names <em>button</em> and <em>count</em>, In order for us to style each of those.</p><p>A class name was not added for the input field as I want to give an example as to how we can style an HTML tag without the use of a class. However it is good practice to add classes where possible.</p><p>Now that we have the added the class names, we can start writing the CSS code. Let’s jump back into <em>component.css</em>.</p><h4><strong>Container CSS</strong></h4><p>As many of us browse the web via our phones, it would be a good idea to make this application as responsive as possible. We could do this using CSS flexbox, however for this tutorial we will instead use Grid. The code snippet below shows the styles used to design the <em>container</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*FK03SvZf9FZClQazSXaDug.png" /><figcaption>components/counter.css</figcaption></figure><p>With the grid, we structured it so that there are three columns and two rows, with a gap between each item being <em>2rem</em>. The text and content within the container are then centred using <em>text-align </em>and <em>justify-content</em>.</p><p><strong>Input CSS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*CJayoNxZer0CMQCG6Z52AA.png" /><figcaption>components/counter.css</figcaption></figure><p>Now for the input field, this will cover each of the three columns in the first row. This is done using <em>grid-column-start </em>and <em>grid-column-end</em>. The great thing about doing this is that the other components, the buttons and the count display, will organise themselves automatically. As their positioning is relative to the input field.</p><p><strong>Count CSS</strong></p><p>For this we just want the <em>count</em> to be displayed so that it is in the centre of the two buttons that are on either side of it (referencing the screenshot of the app provided earlier). We also want the font size to be large enough so that the user can see clearly. The CSS code is shown in the snippet below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/1*jxuD4c8dm-3FTPXVZ7pnhQ.png" /><figcaption>components/counter.css</figcaption></figure><p><strong>Button CSS</strong></p><p>For the finishing touch, we just need to style the buttons. To do this we will add a background colour to it, coral, so that it stands out from the main background. Also giving it some height and a nice border. The code is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*YNRVOMTC5b69QiksW9cTwQ.png" /><figcaption>component/counter.css</figcaption></figure><h4>Adding Styles to App.css</h4><p>I said earlier that we would cover two different ways of adding CSS styles to our React app. The first method was just done, where we created an external CSS file and then imported it into <em>Counter.js</em>. The second method is to write the styles within a React component. We will do this now for <em>App.js</em>. Make the changes shown in the code below (highlighted in green):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*tAIthhOiHewhmPeqTKn0LA.png" /><figcaption>App.js</figcaption></figure><p>This form of styling is known as inline styling, where we write the values as JavaScript objects. You may have noticed a difference between the naming conventions used in the above example with what we wrote for the CSS style sheets. Since the inline CSS is written in a JavaScript object, properties with two names, like <em>text-align</em> or <em>margin-top</em>, must be written with camel case syntax.</p><h3>THAT’S A WRAP</h3><p>Congratulations! We’ve just developed a very basic React application that allows us to add or subtract a specified value from a count. We dabbled with React hooks and added some styles in CSS to make the application responsive.</p><p>Thank you so much for reading this blog post. I hope found it helpful. This entire project is available on my GitHub:</p><p><a href="https://github.com/sixfwa/react-project-1">https://github.com/sixfwa/react-project-1</a></p><p>If you have any comments or feedback, please feel free to comment below or reach me.</p><p>My Twitter is: @sixfwa</p><p><strong>Link to Installation</strong></p><ul><li><a href="https://create-react-app.dev/docs/getting-started">https://create-react-app.dev/docs/getting-started</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcaa3f2d3576" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>