<?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 Ashish kumar on Medium]]></title>
        <description><![CDATA[Stories by Ashish kumar on Medium]]></description>
        <link>https://medium.com/@ashishkb92?source=rss-b6bbd19f6f62------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MoKsDIn7w3pn42nH.</url>
            <title>Stories by Ashish kumar on Medium</title>
            <link>https://medium.com/@ashishkb92?source=rss-b6bbd19f6f62------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:17:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashishkb92/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[Reusable Combobox/Dropdown Component React (Compound pattern)]]></title>
            <link>https://medium.com/@ashishkb92/reusable-combobox-dropdown-component-react-compound-pattern-9add2ab73d8b?source=rss-b6bbd19f6f62------2</link>
            <guid isPermaLink="false">https://medium.com/p/9add2ab73d8b</guid>
            <category><![CDATA[dropdown]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[combobox]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reusable-component]]></category>
            <dc:creator><![CDATA[Ashish kumar]]></dc:creator>
            <pubDate>Fri, 07 Jan 2022 17:31:03 GMT</pubDate>
            <atom:updated>2022-01-07T17:31:03.677Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will learn how to write a simple combo box/dropdown with the help of a compound component pattern.</p><p>This is how our component will look like at the end. (PS: Bad CSS but this article is more about the compound pattern.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*srF5CB9mtQn-jsSaU78stg.png" /></figure><p>We can either have a boilerplate with create-react-app or use codesandbox.io. We will do it with create-react-app. Run the below command in your terminal.</p><pre>npx create-react-app dropdown<br>cd dropdown</pre><p>Go to App.js and remove the boilerplate code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*SYNvloBpVG2Hp0YU0ckZJw.png" /></figure><p>We will use options as</p><pre>const options = [“Apple”, “Microsoft”, “Google”, “Adobe”];</pre><p>Now let us build a skeleton of our reusable react component and our App component is consuming our dropdown component. We will build a controlled component so value and onValueChange will be provided by the consumer. We will write all our components in App.js . In prod, you should modularise it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBPLjgNoB06zwcyWz2oygA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vORLpMr6EjL9iFPyyJY9lw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fz4cW3if4OuKwVX5Rd3-EQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WTHjiEqZZiC3YmVzY-K2nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LqyRl2kJ4wcF1Mmbprekww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrgiWvH02yPSppmwxHZ_UQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1j9Ev1J1gPfYE1xwbhM7Iw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*CImjqpSSlyRPq4oO6gAl8A.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Ffragrant-cache-coyby&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Ffragrant-cache-coyby&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fcoyby%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/e81a7deb9dd8a5afd7ee28f94110ace9/href">https://medium.com/media/e81a7deb9dd8a5afd7ee28f94110ace9/href</a></iframe><p><a href="https://coyby.csb.app/">https://coyby.csb.app/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9add2ab73d8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>