<?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>Forem: Franco Dalmau</title>
    <description>The latest articles on Forem by Franco Dalmau (@francodalmau).</description>
    <link>https://forem.com/francodalmau</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%2F1348992%2F9d8e28b6-13a1-453b-a059-31392b0d2edc.jpeg</url>
      <title>Forem: Franco Dalmau</title>
      <link>https://forem.com/francodalmau</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/francodalmau"/>
    <language>en</language>
    <item>
      <title>Level up your manual testing 🕵️</title>
      <dc:creator>Franco Dalmau</dc:creator>
      <pubDate>Thu, 15 Aug 2024 00:27:31 +0000</pubDate>
      <link>https://forem.com/francodalmau/level-up-your-manual-testing-5a55</link>
      <guid>https://forem.com/francodalmau/level-up-your-manual-testing-5a55</guid>
      <description>&lt;p&gt;Manual testing is a great solution for small and quickly evolving software. It allows for the team to focus on providing business value while minimizing the effort of automatization.&lt;br&gt;
It is, however, a job that requires skill in spite of it's apparent simplicity. I've worked as a full time tester and, even after switching to a developer role, kept on working on my testing skills in order to get ever more efficient with my time.&lt;/p&gt;

&lt;p&gt;These are some tips I have for you in case you're wondering how to take your testing to the next level, wether if it's your role, you want to deliver higher quality features as a developer or you just want to fill in the gaps for your team. &lt;/p&gt;

&lt;h2&gt;
  
  
  Know the product, have a plan
&lt;/h2&gt;

&lt;p&gt;First and foremost, one of the greatest strengths of a manual tester is that they get to regularly approach the application as if they were an end user. And, of course, it's necessary to actually know the end user and the product. Who is going to use it? Where? To accomplish what?&lt;/p&gt;

&lt;p&gt;One of the principles of (good) software testing is that all tests should be planned. We don't have the time and patience to exhaustively test every corner of the app, so try to outline everything that you need to test, make sure you're more thorough in critical areas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where you deliver the most value to users&lt;/li&gt;
&lt;li&gt;In new modules&lt;/li&gt;
&lt;li&gt;In areas that have proven problematic in the past ( it's great to track these! )&lt;/li&gt;
&lt;li&gt;In modules where you know the feature definition has not been up to par or the development has been rushed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I can't stress this enough, specially if your team doesn't have a full time tester and you need to juggle between different tasks, it will allow you to be more efficient with your scheduling and more confident once the tests have passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Focus your effort
&lt;/h2&gt;

&lt;p&gt;Its easy to "get lost" while testing and app and just stumble around while using the different features. In my experience it's really useful to know the different types of testing you're performing and to approach them with clear intention. For example, if i'm testing responsiveness I would go through the whole flow only looking for UI issues, and if I need to also test business logic then I would go through the whole flow again, as to not try to accomplish everything in one sweep. &lt;/p&gt;

&lt;p&gt;Here are the most relevant testing types I come across:&lt;/p&gt;

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

&lt;p&gt;This is the test that checks if the application or module even starts. This type of test should be automated and if a smoke test fails then be aware it might be a red flag in the process that must be addressed, since we shouldn't be even able to deploy a version that doesn't start.&lt;/p&gt;

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

&lt;p&gt;It's a quick check to see at a high level if the app or module works. It's often used to check if a deployment worked correctly and the application is ready for further, deliberate testing. I like to do a quick sanity test mainly to save myself time so that I don't prepare complex scenarios for a feature that wasn't even deployed completely or had some obvious errors.&lt;/p&gt;

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

&lt;p&gt;After modifying the code, we check all the related modules to see if nothing unexpected changed too (If we added B, does A still work?). Regression testing is the most time consuming as the application grows and further down it's the primary target for automation in order to save manual testing time.&lt;/p&gt;

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

&lt;p&gt;it's an unscripted approach where the tester's skills and creativity is put to the test in order to find new ways to break the application or find out performance bottlenecks. The aim is to improve the app in any way. It's different from the infamous "monkey testing" in the sense that exploratory testing is still planned and you need to properly allocate time for it. Monkey testing on the other hand, is just trying out the app, often aimlessly,  for whatever time you have hoping for something to break.&lt;br&gt;
This is where I would check most non functional requirements, as their scenarios are often tedious to write down.&lt;/p&gt;

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

&lt;p&gt;The main tests, this is where we check all the acceptance criteria are met, the app does what it should and we clear out every border case we can think of. It's important to have these tests well documented for further reference, specially so that we can find regressions (i.e: we re run these scenarios as "regression tests" and find out that the results changed)&lt;/p&gt;

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

&lt;p&gt;These are the tests where you check the application can handle the expected workload. Often you need to decide what that expected workload is: is it what normal users will do? Or is it what the application allows?&lt;/p&gt;

&lt;p&gt;A clear example is this: you have a marketplace and can add products to your cart. As a normal user you would try to have, say, less than 20 products in your cart and try if the app keeps being fast enough. But it's likely the hard validation of the cart limit is much higher, perhaps the app lags after the 100th product.&lt;/p&gt;

&lt;p&gt;Both views are important and priorities will shift as the product evolves, the important part is to gain insights about the application limits and keep it in mind going forwards. Just make sure that whatever limits you have won't put the business at risk if a malicious actor appears.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compatibility
&lt;/h3&gt;

&lt;p&gt;It's when we test that the application works in different platforms and devices. Often it's not required to do exhaustive tests of this type except for specific features where the platform might be relevant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Be better than automated tests
&lt;/h2&gt;

&lt;p&gt;Keep in mind that the manual tester is not just a cheaper alternative to automated tests. Having a human being test the app can provide real value and insights that no automation can replace.&lt;br&gt;
An analytical tester can &lt;em&gt;find ambiguity and contradictions in the functional specification&lt;/em&gt;, identify flows that don't feel right, confidently test the design and keep in mind the business goals the module aims to achieve.&lt;br&gt;
Moreover, finding a bug or a point of improvement can be just the start, a tester involved in the product can help with prioritization, definition and, why not, actually fixing some stuff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Work with your team
&lt;/h2&gt;

&lt;p&gt;Lastly, communication with all roles is key, be in the know about how each module came to be. If any part of the process was rushed or suffered constant changes, you can compensate by adjusting the testing plan. By owning the bug backlog you can find patterns and work with devs to help them address underlying technical debt. Your training to detect edge cases might help to define features easier to develop and cheaper to maintain. As a tester you can empower the team to confidently deliver a quality product in spite of the many setbacks that may appear during development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There are teams of all shapes and sizes and I hope you can takeaway something useful to apply to your work! I just want to end this note pointing out that in no way do I think that automated tests should be skipped. What I'm proposing is good communication so that the automated and the manual testing strategies can work cohesively to fill in each others gap.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>productivity</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Keep react component complexity in check with inversion of control</title>
      <dc:creator>Franco Dalmau</dc:creator>
      <pubDate>Wed, 13 Mar 2024 02:20:11 +0000</pubDate>
      <link>https://forem.com/francodalmau/keep-react-component-complexity-in-check-with-inversion-of-control-51c4</link>
      <guid>https://forem.com/francodalmau/keep-react-component-complexity-in-check-with-inversion-of-control-51c4</guid>
      <description>&lt;p&gt;I'm sure at one point in time you've found yourself sitting in front of a desk cluttered with random things! how did it get to that point? Slowly but surely, you've been placing more and more stuff on a perfectly tidy desk until it turned into a pain to fix.&lt;/p&gt;

&lt;p&gt;This is similar to what happens in React components. We start simple and clean, but as we add more features the code becomes messy and hard to maintain.&lt;/p&gt;

&lt;p&gt;Let's see one way we can prevent that.&lt;/p&gt;

&lt;p&gt;Starting with a (simplified) confirmation prompt like this one:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ConfirmationPrompt&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="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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Are&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;sure&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Cancel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Confirm&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="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="c1"&gt;// Used as &amp;lt;ConfirmationPrompt /&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We later find ourselves asking confirmation for an action that is critical to our system. We can add a warning message to emphasize the importance&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;destructive&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="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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;destructive&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;☠️&lt;/span&gt; &lt;span class="nx"&gt;DANGER&lt;/span&gt; &lt;span class="err"&gt;☠️&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Are&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;sure&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Cancel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Confirm&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="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="c1"&gt;// Used as&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt; &lt;span class="nx"&gt;destructive&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things seem good, but what if some actions are dangerous &lt;strong&gt;and&lt;/strong&gt; need to trigger an email notification? We could just copy-paste the same logic, but notice that we quickly run into one BIG problem:&lt;br&gt;
The possible variations of our component &lt;strong&gt;are growing exponentially&lt;/strong&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;destructive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;triggersNotifications&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="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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;triggersNotifications&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;ℹ️&lt;/span&gt; &lt;span class="nx"&gt;Email&lt;/span&gt; &lt;span class="nx"&gt;will&lt;/span&gt; &lt;span class="nx"&gt;be&lt;/span&gt; &lt;span class="nx"&gt;sent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;     &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;destructive&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;☠️&lt;/span&gt; &lt;span class="nx"&gt;DANGER&lt;/span&gt; &lt;span class="err"&gt;☠️&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Are&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;sure&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Cancel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Confirm&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="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="c1"&gt;// Used as &lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt;
 &lt;span class="nx"&gt;destructive&lt;/span&gt;
 &lt;span class="nx"&gt;triggersNotifications&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our first example had 1 possible state, the second had 2 (destructive and non-destructive) but the third now has 4!&lt;/p&gt;

&lt;p&gt;Remember: &lt;u&gt;patterns stick&lt;/u&gt; and &lt;u&gt;code that has changed is prone to keep changing&lt;/u&gt;, so it's best to address this early.&lt;/p&gt;

&lt;p&gt;Here's where things get interesting. Instead of the component acting like a mind reader, guessing what other parts of the code will need out of the ConfirmationPrompt, we can &lt;strong&gt;flip the script&lt;/strong&gt; and make them decide!&lt;br&gt;
This simple and powerful tool is called &lt;strong&gt;inversion of control&lt;/strong&gt;. &lt;br&gt;
Essentially, we're giving back control to the user of our component, making it more flexible and adaptable. &lt;/p&gt;

&lt;p&gt;It looks like this:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;header&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="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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;//Our caller decides what to put here&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Are&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;sure&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Cancel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Confirm&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="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="c1"&gt;// Used as &lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt;
 &lt;span class="nx"&gt;header&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;lt;&amp;gt;&lt;/span&gt;
       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;WillNotifyMessage&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;DangerZoneMessage&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;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// or&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ConfirmationPrompt&lt;/span&gt;
 &lt;span class="nx"&gt;header&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;lt;&lt;/span&gt;&lt;span class="nx"&gt;WillNotifyMessage&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// and any other use case that comes up!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alright! Our original component is kept short and concise while the rest of the codebase is spared the burden of knowing how ConfirmationPrompt should be configured.&lt;/p&gt;

&lt;p&gt;Sadly, it won't help us in keeping a clean desk but inversion of control has many applications in React and you'll find examples with different variations. The idea behind it is always the same:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To give control back to the caller of the function&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
