<?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>DEV Community: kapsebharat1</title>
    <description>The latest articles on DEV Community by kapsebharat1 (@kapsebharat1).</description>
    <link>https://dev.to/kapsebharat1</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%2F920908%2Ffd60cefa-b361-4038-afd3-c572e609f3a1.png</url>
      <title>DEV Community: kapsebharat1</title>
      <link>https://dev.to/kapsebharat1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kapsebharat1"/>
    <language>en</language>
    <item>
      <title>react - onchange of select unable to call second component from first in existing website</title>
      <dc:creator>kapsebharat1</dc:creator>
      <pubDate>Mon, 05 Sep 2022 03:34:05 +0000</pubDate>
      <link>https://dev.to/kapsebharat1/react-onchange-of-select-unable-to-call-second-component-from-first-in-existing-website-4egg</link>
      <guid>https://dev.to/kapsebharat1/react-onchange-of-select-unable-to-call-second-component-from-first-in-existing-website-4egg</guid>
      <description>&lt;p&gt;const e = React.createElement;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class DownloadCenter extends React.Component {

    constructor(props) {
        super(props);

        this.state={
            productDownloadList : []
        }
    }

    componentDidMount() {
        debugger;
        $("#select_productLine13").select2();
        axios({
            method: 'POST',
            url: 'http://localhost:8082/mysoftware/support/pdapi/getProductLines',
            headers: {
                'Content-Type': 'application/json',
                'Accept': 'application/json'
            },
            data: {}

        })
            .then(response =&amp;gt;{
                console.log(response)
                /*#__PURE__*/

                this.setState({productDownloadList : response.data.productLineDTOList})

            })
            .catch(
                error =&amp;gt; {
                    console.log(console.log(error))
                }
            );

    }

    render() {
        debugger;

        const {productDownloadList} = this.state
        let productDownloadList1 = productDownloadList.length &amp;gt; 0 &amp;amp;&amp;amp; productDownloadList.map((item, i) =&amp;gt; {
            return /*#__PURE__*/React.createElement("option", {
                key: i,
                value: item.productLineId
            }, item.productLineName);
        }, void 0);

        return React.createElement("div", {
            class: "fl"
        }, /*#__PURE__*/React.createElement("select", {
            id: "select_productLine13",
            name: "selDataVal",
            onChange: this.aa

        }, productDownloadList1));
     }


}

$("#select_productLine13").on("change", function () {

    debugger;
    console.log("anc")
    /*#__PURE__*/
    React.createElement(DownloadCenter1, null);

})






export default DownloadCenter ;

const domContainer = document.querySelector('#select_productLine13');
const root = ReactDOM.createRoot(domContainer);
root.render(e(DownloadCenter));


---------------------------jsp file which calling above js-------------------------

&amp;lt;script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="https://unpkg.com/@babel/standalone/babel.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="module"  src="&amp;lt;c:url value="/resources/js/reactjs/download_center.js"/&amp;gt;" &amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="module"  src="&amp;lt;c:url value="/resources/js/reactjs/download_center1.js"/&amp;gt;" &amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="https://unpkg.com/axios/dist/axios.min.js"&amp;gt;&amp;lt;/script&amp;gt;




------------------------------download_center1.js-----------------------------------

"use strict";
const e = React.createElement;

class DownloadCenter1 extends React.Component {

    constructor(props) {
        super(props);

        this.state={
            productDownloadList : []
        }
    }

    componentDidMount() {
        debugger;
        $("#select_productLine13").select2();
        axios({
            method: 'POST',
            url: 'http://localhost:8082/mysoftware/support/pdapi/downloadCenter/productNames',
            headers: {
                'Content-Type': 'application/json',
                'Accept': 'application/json'
            },
            data: {}

        })
            .then(response =&amp;gt;{
                console.log(response)
                /*#__PURE__*/
                this.setState({productDownloadList : response.data.productLineDTOList})
            })
            .catch(
                error =&amp;gt; {
                    console.log(console.log(error))
                }
            );

    }

    render() {
        console.log("inside");
        return ;
        //return React.createElement("div", {value: "Hi"});
        /*#__PURE__*/
        //React.createElement(DataTable, {
        //    title: "Desserts",
        //    selectableRows: true
        //});
    }

}

export default DownloadCenter1 ;
const domContainer = document.querySelector('#select_productLine112');

const root = ReactDOM.createRoot(domContainer);

root.render(e(DownloadCenter1));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
  </channel>
</rss>
