<?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 Fatimat Gbajabiamila on Medium]]></title>
        <description><![CDATA[Stories by Fatimat Gbajabiamila on Medium]]></description>
        <link>https://medium.com/@fatimat?source=rss-2d5e22206c1d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*bgLTJ0FA0-Jv2TcQeGOKUQ.jpeg</url>
            <title>Stories by Fatimat Gbajabiamila on Medium</title>
            <link>https://medium.com/@fatimat?source=rss-2d5e22206c1d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 17:53:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fatimat/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[12 months, 12 concepts learned]]></title>
            <link>https://medium.com/apolitical-engineering/12-months-12-concepts-learned-618d87475a60?source=rss-2d5e22206c1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/618d87475a60</guid>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[apolitical]]></category>
            <dc:creator><![CDATA[Fatimat Gbajabiamila]]></dc:creator>
            <pubDate>Mon, 16 Nov 2020 10:44:50 GMT</pubDate>
            <atom:updated>2020-11-16T10:44:50.350Z</atom:updated>
            <content:encoded><![CDATA[<p>I remember vividly where I was when a recruiter sent me a message about a new opportunity at Apolitical. It was probably one of the best messages I have ever got from a recruiter — I had to reply.</p><p>One year on, I have no regrets about that decision. I have spent the past few days reflecting on my experience so far: what I have learnt, how I have contributed to the company and the challenges I have overcome.</p><p>As a software engineer without a computer science background, I often come across new terminology and principles of software design and architecture. I usually ask questions and google for more explanation. I thought it would be good to share some of what I learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoxTZcob68MBXzUcpp9mnA.jpeg" /><figcaption>Image <a href="https://pixabay.com/illustrations/cloud-computing-network-internet-2001090/">https://pixabay.com/illustrations/cloud-computing-network-internet-2001090/</a></figcaption></figure><ol><li>Server</li></ol><p>A server is a computer (hardware or software) set up to provide data or functionality to other programs. To give an example of this in action, when you visit a webpage, your device (the client) asks another computer (the server) for that webpage, which then gets built and sent back to your device.</p><p>A server can be set up using a PC: you just need to install the right software. Big companies, with many uses for their servers, usually situate them in a rectangular structure called a server rack. They often have air conditioning to help keep the servers cool and prevent overheating. So servers are usually in a cold room with lots of wire lights!</p><p>2. Serverless</p><p>At Apolitical, we don’t have a server room. Our data is stored in the cloud — which I explain below. We mostly use web API servers to pass data to and from our website.</p><p>Serverless is a cloud computing concept that allows you to build and run applications without having to manage servers yourself. The application will still be running on servers but this will be managed by your cloud service provider(i.e Amazon web services or Google cloud platform). It often takes away the need to manage a cold server room!</p><p>3. Cloud computing</p><p>Cloud computing means storing and accessing data and programs over the internet. Cloud computing also makes it possible for tools and applications like data storage, servers, databases, networking, and software to work via the internet.</p><p>It is thanks to cloud computing that we are now able to have files saved on things like google drive, one drive, icloud etc. In fact, this blog was originally written on google doc.</p><p>4. Cloud function</p><p>Function As A service = Cloud Functions.</p><p>You implement a functionality in your code that is automatically run when the specified event occurs.</p><p>Cloud functions are serverless- you deploy the code and google does all the work for you.</p><p>You can read more about them here <a href="https://cloud.google.com/functions/docs/concepts/overview">https://cloud.google.com/functions/docs/concepts/overview</a></p><p>5. Cron jobs</p><p>A cron job is a task scheduled by a script or command to run automatically at certain intervals on the server. The name ‘cron’ comes from the Greek word for time, ‘chronos’, so it’s a pretty apt name to give something we set a time for.</p><p>Cron is a daemon, meaning that it works in the background and doesn’t cause any interruption to other parts of your codebase. For example, if you have a website that users subscribe to and each account has an expiration date, you can write a cron job to run every 2 hours to deactivate or delete the accounts that are past their expiration dates.</p><p>6. A/B testing</p><p>A/B testing is a method for comparing two modifications of a web page or app against each other, to determine which one performs better. You set the web page up to show half of your users one version, and the other half the other version.</p><p>For example, let’s say you have 2 articles (‘How to mentor junior developers’ and ‘How to be a good software developer’. You want to test which article your website visitors will find the most useful. You can have two different pop-ups that display when a user is on the homepage. Each pop-up will have a description of the article and a link to the article in similar designs. If you show some users ‘How to mentor junior developers’ pop up, and other users ‘How to be a good software developer’. You can determine which one will do better based on the number of clicks each pop-up gets. The article with the most clicks wins!</p><p>7. Server-side rendering</p><p>Server-side rendering is when a website requests html to render from the server. It converts the html into information that can be displayed by the browser.</p><figure><img alt="Image illustrating server side rendering" src="https://cdn-images-1.medium.com/max/562/1*f5n98_VB7dzlC_tGWmmRog.png" /><figcaption>Diagram illustrating server side rendering</figcaption></figure><p>By having the page load before the javascript, it loads faster initially. It can also help your page appear higher in search results. Server-side rendering is good for public-facing pages like a homepage where the content doesn’t change too often or doesn’t need to be dynamic.</p><p>For more information, read here <a href="https://www.freecodecamp.org/news/what-exactly-is-client-side-rendering-and-hows-it-different-from-server-side-rendering-bd5c786b340d/">https://www.freecodecamp.org/news/what-exactly-is-client-side-rendering-and-hows-it-different-from-server-side-rendering-bd5c786b340d/</a></p><p>8. VPN</p><p>VPN stands for Virtual Private Network. If you are using a VPN, you are able to connect to the internet in a safe and secure way, and keep your private information private.</p><p>It works by redirecting your device’s internet connection through your VPN provider’s private server. This means that when you send or receive data, it is done via the VPN rather than your computer.</p><p>It also hides your IP address — a number reference assigned to your device by your internet service provider — therefore protecting your identity.</p><p>Imagine a hacker is trying to intercept data. For example, they might want access to data you submit on a particular site, such as your bank details.- If you use a VPN, they won’t be able to access it as the data is encrypted until it reaches its final destination as set by the webpage.</p><p>9. Virtual machine</p><p>A virtual machine is a computer file, that behaves like an actual computer. It makes it possible to run a different operating system on your computer. If you use a Mac, you can download a virtual machine that allows you to run Windows on it.</p><p>10. Microservices</p><p>Microservices is a method of building software by splitting it into smaller pieces that exist independently of each other.</p><p>To put it more simply, we have different repositories (folders) for different parts of the platform but the code in the different repositories often communicate with each other. Microservices can make it easier to identify where a problem is coming from, if there is one, and can be a good way of breaking out parts of the platform to allow people to work on different things at once.</p><p>11. Clickjacking</p><p>Clickjacking refers to an attack on a website where the user is tricked into clicking on something that is made to look like it belongs on the website.</p><p>This can cause users to unknowingly download a virus, go on malicious web pages, submit sensitive personal information, transfer money, or buy products online.</p><p>As developers, having code in place to prevent these kinds of attacks is our duty and one that should be taken very seriously.</p><p>12. Graph database</p><p>A graph has two elements: a node and a relationship. Each node represents an entity. This can be a place, thing, person, category or other relevant piece of data. Each relationship represents how two nodes are linked.</p><p>Graph databases are often used by social media sites to establish social connections or infer relationships between people based on their activities.</p><p>Given the people (nodes) and their connections (relationships), you can find out who the ‘friends of friends’ of a particular person are.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=618d87475a60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/apolitical-engineering/12-months-12-concepts-learned-618d87475a60">12 months, 12 concepts learned</a> was originally published in <a href="https://medium.com/apolitical-engineering">Apolitical Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cookies FAQ]]></title>
            <link>https://medium.com/coderlist/cookies-faq-1f410351925a?source=rss-2d5e22206c1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f410351925a</guid>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[cookies]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[faq]]></category>
            <dc:creator><![CDATA[Fatimat Gbajabiamila]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 14:33:39 GMT</pubDate>
            <atom:updated>2020-03-03T14:33:39.543Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cookies — FAQs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*aWprdTsvwNHC8-begZ185Q.jpeg" /></figure><p>Have you ever wondered why websites are asking you to accept cookies every time? Do you often wonder what the cookies are or what they are used for? The FAQ below answers some of the questions you might have asked yourself about cookies.</p><h4>What are they?</h4><p>Cookies contain information saved on your computer by a website you visit. On your first visit to a site, some websites would download and/or send small pieces of data from the site to your computer. The file is stored in your browser’s folder or subfolder.</p><p>A cookie often contains the name of the cookie(set by the website creator), the value(alphanumeric, usually unique), the domain(i.e website) the cookie is for, the path/page of the website, cookie expiry date and if the cookie is secure or not.</p><h4>What are cookies used for?</h4><p>Cookies are intended to help improve your experience on a website and often to add more unique functionality.</p><p>The most common use case of a cookie is to help websites creators keep track of your visits and activity. When people hear the word ‘track’, they often panic and conclude that it is a bad thing which, to be honest, is a fair reaction in this day and age.</p><p>An example of what I mean could be when you log in to a website for the first time. The website creator can save a unique identifier to the browser’s cookie to assert that the user has logged in. The next time you visit the website, it checks if you have this cookie so the website will not ask you to log in again. We can all agree that’s a good thing, right?</p><p>Some online retailers could also use cookies to save items you put in your basket. If they didn’t do this, every time you refreshed the page, you would lose all the items in your basket and have to go through the process of adding it all again each time. I know for sure that would annoy me!</p><p>A social network(i.e twitter, facebook) might use cookies to keep a record of all the links you have clicked on the site. Using this record, they are able to tailor advertising/marketing on the site to you.</p><p><strong>Why do I have to accept that annoying cookie policy thing?</strong></p><p>The <a href="https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:32016R0679">General Data Protection Regulation</a> (GDPR) came into force on 25 May 2018. I personally remember getting loads of emails from different websites, asking me to opt in or opt out of their subscribers list- this is an effect of GDPR.</p><p>GDPR was designed to give you more control over what information a company has about you, ensures companies are more transparent about what they are using your data for and gives you the right of access to the data the company has about you for free within reason. Asking you to accept the cookie policy is one of the ways companies are trying to comply with GDPR, by asking you to opt in and giving you access to their cookie policy. Website creators are also obligated to tell you what they are storing in the cookies, this is usually referred to as “Cookie policy” and can be found in the same section of the site that asks you to accept the policy.</p><h4>Can I decline the cookie policy?</h4><p>You can, but they will keep asking you each time you go back on to the website. In some cases, you will not be able to access a website if you do not accept the cookie policy. This is often because the website won’t work as designed to if you don’t as they will not be legally allowed to save anything to the text file that stores your cookies. In other cases, you are given access only to pages on the site that do not use any data stored in the cookie. What happens when you decline is up to the website creator.</p><h4>Do they contain my personal data?</h4><p>Ultimately, the data stored in a cookie is determined by the creator of the website. It is not good practice for them to store identifiable information in the cookie. In any case, the value of the cookie often contains numbers and letters that only the website you are visiting can understand. This is because the data is usually encrypted — easy for a machine to understand but not so easy for us humans to read.</p><h4>Can I see what is stored in a cookie?</h4><p>Browsers have different ways you can access your cookies. Below are where you can find your cookies in commonly used browsers:</p><ul><li><a href="https://support.google.com/chrome/answer/95647?co=GENIE.Platform%3DDesktop&amp;hl=en">Chrome</a></li><li><a href="https://support.apple.com/en-gb/guide/safari/sfri11471/mac">Safari</a></li><li><a href="https://support.microsoft.com/en-gb/help/17442/windows-internet-explorer-delete-manage-cookies">Internet Explorer</a></li></ul><p>You can also delete your cookies using the links above.</p><h4>Do cookies expire?</h4><p>There are two main ways website creators use to determine how long a cookie is stored on your device. This can either be via a session cookie or a persistent cookie. A session cookie is saved as soon as you visit a website and disappears as soon as you close it. It is only used by the website on a per-visit basis. A persistent cookie, however, has a future expiry date set by the website creator. This cookie is saved on your computer’s hard drive so even if you close the website that sets it and then go back on a later date, from your hard drive, it can still use the cookie originally stored.</p><h4>How do cookies help companies with advertising?</h4><p>Cookies were designed to only be read by the website that creates them. When you log in to a site like Facebook, it stores a cookie on your computer so that next time you visit the site, it checks for that cookie to make sure you are logged in. That cookie is unique to Facebook and cannot be read by other sites.</p><p>However, there is another type of cookies known as third-party cookies, they piggyback off the original website you visited and are mostly added to your computer by advertisers. Advertising companies use third-party cookies to keep track of what ads you’ve seen, or what ads your browser has been exposed to helping them to show ads that are relevant to your browsing habits.</p><p>For example, when you visit a website with a banner ad from a site like Boohoo, your browser is communicating with the site and the advertiser. The advertiser that placed the Boohoo banner ad on your website assigns your computer a unique identifier number that is stored in your cookie text file. Then, let’s say you visit another website with the same advertiser’s Boohoo banner ad. When you arrive at this new website, the advertiser will check to see if you have the unique ID from them and will use that to show you related ads. They also store information about whether or not you clicked the ads you’ve seen, and record information about the site you saw the banner ad on.</p><p>In summary, Cookies were not originally designed to track you or invade your privacy online, however, some website creators do abuse it. Every company asking you to accept cookies will also provide you with a link to their Cookie policy. You can read the policy to see what the website uses your cookies for to help you make a more informed decision about whether accepting is worth it to you.</p><p>Hope you found this useful. Get in touch via twitter <a href="https://twitter.com/FG_webdev">@fg_webdev</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f410351925a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coderlist/cookies-faq-1f410351925a">Cookies FAQ</a> was originally published in <a href="https://medium.com/coderlist">Junior Dev Diaries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How a Front-end developer can build a full-stack web app]]></title>
            <link>https://medium.com/coderlist/how-a-front-end-developer-can-build-a-full-stack-web-app-811fb7dcd6f5?source=rss-2d5e22206c1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/811fb7dcd6f5</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Fatimat Gbajabiamila]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 11:46:13 GMT</pubDate>
            <atom:updated>2021-01-12T23:17:55.198Z</atom:updated>
            <content:encoded><![CDATA[<h3>How a front-end developer can build a full-stack web app.</h3><p>When you first start thinking of learning how to code, there is no doubt the amount languages/frameworks out there is overwhelming. Deciding which one to start off with can be a daunting task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*El7jNYMuqzEoE-1ninaRSA.jpeg" /><figcaption><a href="https://www.itonlinelearning.com/blog/which-programming-language-should-i-learn-first/">Image source</a></figcaption></figure><p>Most people looking to get into web development usually start off with front-end (HTML, CSS and JavaScript), at least that’s what I’d advise if you are considering it. The problem is people learning front-end often don’t get enough experience interacting with APIs and doing things like saving and handling data, which is actually a huge part of the job.</p><p>For example if you want to build a website that displays people from different countries. On the website, you want to have a form for people to join and you want to display a list of all the people that have already joined. Your first thought is you need a database to store the people’s details and countries. But how do you then link this database to your website? After some googling, you find out that you need to build an API that serves as a middleman between your database and your front-end code. To build an API, you now have to learn a back-end language. You know you want to eventually learn these things but you don’t think you are ready yet. What do you do?</p><p>This blog post will introduce you to a platform that allows you to build your website without having to learn a backend language or database. I recommend using it to serve as a soft introduction to APIs and structuring data.</p><h3>What is this platform?</h3><p>It is called <strong>Airtable</strong>.</p><p>As described on their website:</p><blockquote>Airtable works like a spreadsheet but gives you the power of a database to organise anything.</blockquote><p>Airtable stores your data in a spreadsheet, and that is what I love the most about it. Spreadsheets are familiar to a lot of us — you’ve probably used them at work, school or for personal use. If you haven’t used a spreadsheet, Airtable is a good starting point, or maybe try playing around with Microsoft Excel.</p><p>You can use Airtable for a wide range of things like project management, event planning, recruiting and many more. I will focus on how you can use it as a database for your web application.</p><h3>What can you do with it</h3><p>Each spreadsheet in Airtable is known as a “base”- a base can have multiple sheets. To build your website with Airtable, you create your base. Ours will have two sheets: People and Countries. Below are some of the things you can use Airtable for when building your web application.</p><ul><li>Create and embed forms in your website</li></ul><p>If you want users to fill out a form on your website so they can be added to the list, you can choose to create one from scratch and send a request to the Airtable API to add them to your ‘People’ sheet. However, Airtable makes this easier by allowing you to embed forms to your website. The code to do this is provided by Airtable and they have a guide on forms, link below.</p><ul><li>Link sheets</li></ul><p>Airtable allows you to link sheets within a base. I highly recommend you play around with linking your tables if you use Airtable. It is a good way to gain an understanding on creating relationships between different types of tables. This is a big part of database management. In your base, you can have a sheet for ‘People’, where you save their personal details, and another sheet for ‘Countries’, where you save all the countries. From your ‘People’ sheet, you can link to the ‘Countries’ sheet so users can choose from the list of countries you’ve added to that sheet. In your countries sheet, a column for ‘People’ will be automatically added to show which people are added to which country.</p><ul><li>Create, Read, Update and Delete (CRUD) record(s).</li></ul><p>With Airtable API, you can perform all CRUD operations commonly done when working with data in your web/mobile application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/671f5364b09d87df75b684834fc7bf7a/href">https://medium.com/media/671f5364b09d87df75b684834fc7bf7a/href</a></iframe><p>Another plus side to Airtable is that the API is well documented. For each base, you get documentation with detailed instructions on how to make all CRUD requests for data in the base. The URLs used to retrieve and delete in the code snippet above was provided to me from my own base documentation.</p><p>There is also an Airtable community forum, like Stack Overflow but for Airtable specific questions. If you have a question, you can ask in the forum. Most likely, you will find there is already an answer to your question.</p><p>To get started with Airtable, create an account and create your own base. You can choose to start from scratch or use one of the templates available. The Airtable guide contains useful information on how to get started with base and the spreadsheet. The support page has more information about using the app in general.</p><h3><strong>Useful links</strong></h3><ul><li>Which programming language should you learn first?:<a href="https://medium.freecodecamp.org/what-programming-language-should-i-learn-first-%CA%87d%C4%B1%C9%B9%C9%94s%C9%90%CA%8C%C9%90%C9%BE-%C9%B9%C7%9D%CA%8Dsu%C9%90-19a33b0a467d"> FCC Blog</a></li><li>Airtable home page: <a href="https://airtable.com/">https://airtable.com/</a></li><li>Airtable community forum:<a href="https://community.airtable.com/"> https://community.airtable.com/</a></li><li>Airtable support page: <a href="https://support.airtable.com/hc/en-us">https://support.airtable.com/hc/en-us</a></li><li>Airtable guide:<a href="https://guide.airtable.com/"> https://guide.airtable.com/</a></li><li>Guide to airtable forms (including how to embed form into your website: <a href="https://support.airtable.com/hc/en-us/articles/206058268-Guide-to-forms">https://support.airtable.com/hc/en-us/articles/206058268-Guide-to-forms</a></li><li>Using Airtable as a database to store realtime messages: https://www.ably.io/blog/airtable-database-realtime-messages</li></ul><p>If you enjoyed this article, please recommend and share. Get in touch with me on <a href="https://twitter.com/FG_webdev">twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=811fb7dcd6f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coderlist/how-a-front-end-developer-can-build-a-full-stack-web-app-811fb7dcd6f5">How a Front-end developer can build a full-stack web app</a> was originally published in <a href="https://medium.com/coderlist">Junior Dev Diaries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Testing your Redux Code]]></title>
            <link>https://medium.com/coderlist/introduction-to-testing-your-redux-code-671c84351e0c?source=rss-2d5e22206c1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/671c84351e0c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Fatimat Gbajabiamila]]></dc:creator>
            <pubDate>Thu, 16 Aug 2018 13:32:27 GMT</pubDate>
            <atom:updated>2018-10-07T09:08:00.000Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are wondering how to test your redux code, read on!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1HRu4YeZDn3PAS81QjuNg.jpeg" /></figure><p><strong>Prerequisites for better understanding of post</strong></p><ul><li>Basic understanding of redux</li><li>Basic understanding of Test Driven Development</li><li>Using Jest for testing</li></ul><p><strong>What you’ll learn</strong></p><ul><li>How to test an action creator</li><li>How to test test a reducer</li><li>Useful modules you can use when testing</li></ul><h3>Dismantling redux and its jargons</h3><p>Redux is a state(i.e data) management tool for web applications and can be used with many libraries and frameworks.</p><p>All state in redux are stored and managed via <strong>redux store</strong> and is created using the createStore() method. The create store method takes a **reducer** as its argument.</p><p>To update your state in redux you have to dispatch(i.e send) an <strong>action</strong> using an <strong>action creator</strong>. An action is an object containing type and often payload. Type describes the action, it is a string and you can name it whatever you want. Payload is the data you want to add to your redux store. Data can be of any data type and you can choose to call it something other than payload but payload is commonly used. Actions are used to pass data to your store.<br>Action creators are functions that return an action object.</p><p>The reducer previously mentioned is a function that communicates with the store. It is a pure function, that is, it takes in the previous state and an action as its arguments and always returns a new state.</p><h3>Setting up for testing</h3><p>I will be demonstrating by testing a action creator that logs a user out of your web application.</p><p>To get started I will create a test support file. I usually call my file test-support.js.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de454cd923179cd452e910b2766aa129/href">https://medium.com/media/de454cd923179cd452e910b2766aa129/href</a></iframe><h3>Testing action creator</h3><p>Now that the set up is out of the way, I can move on to testing our action creator.</p><p>I will first define the action type in a variable</p><pre>const LOGOUT_USER = “LOGOUT_USER”;</pre><p>The code below is an action creator that logs out a user from a web app. The action creator makes a call to an api route.</p><pre>const logout = () =&gt; {<br>  return dispatch =&gt; {<br>    return axios.get(&quot;/api/logout&quot;).then(() =&gt; {<br>      dispatch({<br>        type: LOGOUT_USER,<br>        payload: false<br>      });<br>    });<br>  };<br>};</pre><p>In the code below, I am testing that the logout function defined above is returning the right action for logging out a user. I am going to assume you are familiar with the syntax for testing using jest and not go into much details about that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e33cd8f3c752b0f3ef47367d69d2f18b/href">https://medium.com/media/e33cd8f3c752b0f3ef47367d69d2f18b/href</a></iframe><h3>Testing reducer</h3><p>As we know already, a reducer is the function that returns an action and is responsible for updating your state in the store.</p><p>Below I am declaring an alert reducer which I will be testing.</p><pre>const alertReducer = (state = {}, action) =&gt; {<br>  switch (action.type) {<br>  case ADD_ERROR:<br>    return { state, ...action.payload };<br>  default:<br>    return state;<br>  }<br>};</pre><p>I will write a test to check my state is been updated when an error is dispatched, that is, it does not equal the initial state.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31169024c207d7b462ede69fd71aa946/href">https://medium.com/media/31169024c207d7b462ede69fd71aa946/href</a></iframe><p>That’s it! I hope you’ve learnt a thing or two.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=671c84351e0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coderlist/introduction-to-testing-your-redux-code-671c84351e0c">Introduction to Testing your Redux Code</a> was originally published in <a href="https://medium.com/coderlist">Junior Dev Diaries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>