<?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[Our Daily Bread Engineering - Medium]]></title>
        <description><![CDATA[Engineering blog for everyone’s carb-based devotional - Medium]]></description>
        <link>https://medium.com/our-daily-bread-engineering?source=rss----e16011361783---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Our Daily Bread Engineering - Medium</title>
            <link>https://medium.com/our-daily-bread-engineering?source=rss----e16011361783---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 14:59:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/our-daily-bread-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Feature Toggling and A/B Testing with React]]></title>
            <link>https://medium.com/our-daily-bread-engineering/feature-toggling-and-a-b-testing-with-react-425b785b7e7?source=rss----e16011361783---4</link>
            <guid isPermaLink="false">https://medium.com/p/425b785b7e7</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[scaled-agile]]></category>
            <dc:creator><![CDATA[BJ Clark]]></dc:creator>
            <pubDate>Wed, 05 Jun 2019 21:54:45 GMT</pubDate>
            <atom:updated>2019-06-06T20:55:51.210Z</atom:updated>
            <content:encoded><![CDATA[<h3>Feature Toggling and A/B Testing with Serverless &amp; React</h3><p><em>Note: This article assumes you have a basic understanding of the Serverless Framework and React</em></p><p>Every 10 weeks, our team work on “hackathon” projects, which allow us to dive into new projects and technologies that benefit the organization, but are exploratory in nature, and let us have fun learning new things.</p><p>Our latest hackathon tackled something that we have seen the need for within our applications: the ability to turn on and off features with the flip of the switch, as well as control what percentage of users see what features.</p><p>Feature toggling is a key tenant of <a href="https://www.scaledagileframework.com/release-on-demand/">Scaled Agile</a> — it allows us to “release on demand”, meaning we can push code to production at any time, even if it hasn’t been completed, then turn it on whenever it is ready.</p><p>A/B Testing, at least in the sense that we are using it, is testing different versions of features to see how they performance against each other.</p><h3>Just Get to the Code Already!</h3><p>Okay, here goes.</p><p>Our feature toggle setup relies on a basic AWS Serverless stack (API Gateway + DynamoDB + Lambda) on the backend and a static React frontend (stored in S3).</p><h4>The Backend</h4><p>Here’s what our serverless.yml file looks like: <a href="https://gist.github.com/bjclark13/6ed31b6f976dd54c71095df5a47334a6">https://gist.github.com/bjclark13/6ed31b6f976dd54c71095df5a47334a6</a></p><p>The back end is pretty simple, it has basic CRUD endpoints for features. The real crux of the logic is in the GET request:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73f7578e2d3da1c25624091ab1288a18/href">https://medium.com/media/73f7578e2d3da1c25624091ab1288a18/href</a></iframe><p>(See the full handler here: <a href="https://gist.github.com/bjclark13/d418e8f4a2b4830b209521b539875a90">https://gist.github.com/bjclark13/d418e8f4a2b4830b209521b539875a90</a>)</p><p>Here we have two types of features: <strong>A/B </strong>and <strong>Toggle </strong>(simply on or off). If it is an A/B test, then we storage a percentage of the audience that we want to display it for.</p><p>If it is a toggled feature, that simply means you either set it on or off based on whether the feature is enabled.</p><p>The endpoint will then return a JSON object containing the list of features, and whether they should be on or off.</p><pre>{<br>  &quot;FeatureAdminLink&quot;: 0,<br>  &quot;DevotionalImage&quot;: 1<br>}</pre><h4>The Frontend</h4><p>The React code has two main parts: the implementation of the feature toggling, and the admin interface for creating new feature toggles.</p><p>Our Feature component is an element that can wrap any other elements. It makes a get request to the API to check if it should be on, and if it is, then it displays the inner elements.</p><pre>&lt;Feature featureName=&quot;ReallyCoolFeature&quot;&gt;<br>   &lt;ReallyCoolFeature/&gt;<br>&lt;/Feature&gt;</pre><p>This is one of the things that is super easy with React, you can just have a state to determine whether or not to show the inner contents:</p><pre>render () {</pre><pre>  return(</pre><pre>    this.state.isVisible ?</pre><pre>      this.props.children</pre><pre>    : null</pre><pre>  )</pre><pre>}</pre><p>You can see the full feature component here: <a href="https://gist.github.com/bjclark13/79b8895628a35338bb0ae7e66203e237">https://gist.github.com/bjclark13/79b8895628a35338bb0ae7e66203e237</a></p><p>The admin interface utilizes <a href="https://material-ui.com/">https://material-ui.com/</a> and <a href="https://github.com/aws-amplify/amplify-js">https://github.com/aws-amplify/amplify-js</a>. Material UI makes it easy to build pretty interfaces, and Amplify handles authentication for making API requests.</p><h3>To Sum It Up</h3><p>We quickly learned that feature toggling, while incredibly valuable, is not that difficult to implement. This would be advice on anyone trying out an idea — start with something small and simple, so you can quickly determine how meaningful the thing you built really is.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=425b785b7e7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/our-daily-bread-engineering/feature-toggling-and-a-b-testing-with-react-425b785b7e7">Feature Toggling and A/B Testing with React</a> was originally published in <a href="https://medium.com/our-daily-bread-engineering">Our Daily Bread Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>