<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to add React JS component to the Widget in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-add-react-js-component-to-the-widget/m-p/1065840#M20935</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Trying to add simple React JS component to the WAB widget getting error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LaurynasGedminas2_0-1623114920251.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/15380i77342296BE260897/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LaurynasGedminas2_0-1623114920251.png" alt="LaurynasGedminas2_0-1623114920251.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Widget.js:&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;/* eslint-disable no-console */&lt;/P&gt;&lt;P&gt;// Load Extrenal Libs&lt;BR /&gt;require({&lt;BR /&gt;paths: {&lt;BR /&gt;react:&lt;BR /&gt;'&lt;A href="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min" target="_blank"&gt;https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min&lt;/A&gt;',&lt;BR /&gt;'react-dom':&lt;BR /&gt;'&lt;A href="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.production.min" target="_blank"&gt;https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.production.min&lt;/A&gt;'&lt;BR /&gt;},&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Widget&lt;BR /&gt;define([&lt;BR /&gt;'dojo/_base/declare',&lt;BR /&gt;'dojo/aspect',&lt;BR /&gt;'jimu/BaseWidget',&lt;BR /&gt;'jimu/LayerInfos/LayerInfos',&lt;BR /&gt;'esri/layers/FeatureLayer',&lt;BR /&gt;'react',&lt;BR /&gt;'react-dom',&lt;BR /&gt;'./_App',&lt;BR /&gt;], (&lt;BR /&gt;declare,&lt;BR /&gt;aspect,&lt;BR /&gt;BaseWidget,&lt;BR /&gt;LayerInfos,&lt;BR /&gt;FeatureLayer,&lt;BR /&gt;React,&lt;BR /&gt;ReactDOM,&lt;BR /&gt;App&lt;BR /&gt;) =&amp;gt; {&lt;BR /&gt;return declare([BaseWidget], {&lt;BR /&gt;baseClass: 'my-react-widget',&lt;/P&gt;&lt;P&gt;renderWidget() {&lt;BR /&gt;&lt;BR /&gt;console.log(this.folderUrl);&lt;BR /&gt;// props&lt;BR /&gt;const wab = {&lt;BR /&gt;map: this.map,&lt;BR /&gt;config: this.config,&lt;BR /&gt;id: this.id,&lt;BR /&gt;};&lt;BR /&gt;const esriJS = {&lt;BR /&gt;LayerInfos,&lt;BR /&gt;FeatureLayer,&lt;BR /&gt;};&lt;BR /&gt;// open/close handlers&lt;BR /&gt;const onOpen = func =&amp;gt; {&lt;BR /&gt;aspect.after(this, 'onOpen', func, true);&lt;BR /&gt;};&lt;BR /&gt;const onClose = func =&amp;gt; {&lt;BR /&gt;aspect.after(this, 'onClose', func, true);&lt;BR /&gt;};&lt;BR /&gt;const root = document.getElementById('my-react-widget-root');&lt;BR /&gt;ReactDOM.render(React.createElement(App), root);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;},&lt;BR /&gt;// ------------------------ //&lt;BR /&gt;// WIDGET LIFECYCLE&lt;BR /&gt;// ------------------------ //&lt;BR /&gt;startup() {&lt;/P&gt;&lt;P&gt;this.renderWidget();&lt;BR /&gt;&lt;BR /&gt;},&lt;BR /&gt;postCreate: function(){&lt;BR /&gt;&lt;BR /&gt;},&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;_App.js:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;"use strict";&lt;/P&gt;&lt;P&gt;var _react = _interopRequireDefault(require("react"));&lt;/P&gt;&lt;P&gt;function _interopRequireDefault(obj) { return obj &amp;amp;&amp;amp; obj.__esModule ? obj : { default: obj }; }&lt;/P&gt;&lt;P&gt;class Car extends _react.default.Component {&lt;BR /&gt;render() {&lt;BR /&gt;return /*#__PURE__*/_react.default.createElement("h2", null, "**bleep**, World!");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;Is even posible?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jun 2021 01:11:24 GMT</pubDate>
    <dc:creator>LaurynasGedminas2</dc:creator>
    <dc:date>2021-06-08T01:11:24Z</dc:date>
    <item>
      <title>How to add React JS component to the Widget</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-add-react-js-component-to-the-widget/m-p/1065840#M20935</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Trying to add simple React JS component to the WAB widget getting error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LaurynasGedminas2_0-1623114920251.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/15380i77342296BE260897/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LaurynasGedminas2_0-1623114920251.png" alt="LaurynasGedminas2_0-1623114920251.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Widget.js:&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;/* eslint-disable no-console */&lt;/P&gt;&lt;P&gt;// Load Extrenal Libs&lt;BR /&gt;require({&lt;BR /&gt;paths: {&lt;BR /&gt;react:&lt;BR /&gt;'&lt;A href="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min" target="_blank"&gt;https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min&lt;/A&gt;',&lt;BR /&gt;'react-dom':&lt;BR /&gt;'&lt;A href="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.production.min" target="_blank"&gt;https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.production.min&lt;/A&gt;'&lt;BR /&gt;},&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Widget&lt;BR /&gt;define([&lt;BR /&gt;'dojo/_base/declare',&lt;BR /&gt;'dojo/aspect',&lt;BR /&gt;'jimu/BaseWidget',&lt;BR /&gt;'jimu/LayerInfos/LayerInfos',&lt;BR /&gt;'esri/layers/FeatureLayer',&lt;BR /&gt;'react',&lt;BR /&gt;'react-dom',&lt;BR /&gt;'./_App',&lt;BR /&gt;], (&lt;BR /&gt;declare,&lt;BR /&gt;aspect,&lt;BR /&gt;BaseWidget,&lt;BR /&gt;LayerInfos,&lt;BR /&gt;FeatureLayer,&lt;BR /&gt;React,&lt;BR /&gt;ReactDOM,&lt;BR /&gt;App&lt;BR /&gt;) =&amp;gt; {&lt;BR /&gt;return declare([BaseWidget], {&lt;BR /&gt;baseClass: 'my-react-widget',&lt;/P&gt;&lt;P&gt;renderWidget() {&lt;BR /&gt;&lt;BR /&gt;console.log(this.folderUrl);&lt;BR /&gt;// props&lt;BR /&gt;const wab = {&lt;BR /&gt;map: this.map,&lt;BR /&gt;config: this.config,&lt;BR /&gt;id: this.id,&lt;BR /&gt;};&lt;BR /&gt;const esriJS = {&lt;BR /&gt;LayerInfos,&lt;BR /&gt;FeatureLayer,&lt;BR /&gt;};&lt;BR /&gt;// open/close handlers&lt;BR /&gt;const onOpen = func =&amp;gt; {&lt;BR /&gt;aspect.after(this, 'onOpen', func, true);&lt;BR /&gt;};&lt;BR /&gt;const onClose = func =&amp;gt; {&lt;BR /&gt;aspect.after(this, 'onClose', func, true);&lt;BR /&gt;};&lt;BR /&gt;const root = document.getElementById('my-react-widget-root');&lt;BR /&gt;ReactDOM.render(React.createElement(App), root);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;},&lt;BR /&gt;// ------------------------ //&lt;BR /&gt;// WIDGET LIFECYCLE&lt;BR /&gt;// ------------------------ //&lt;BR /&gt;startup() {&lt;/P&gt;&lt;P&gt;this.renderWidget();&lt;BR /&gt;&lt;BR /&gt;},&lt;BR /&gt;postCreate: function(){&lt;BR /&gt;&lt;BR /&gt;},&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;_App.js:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;"use strict";&lt;/P&gt;&lt;P&gt;var _react = _interopRequireDefault(require("react"));&lt;/P&gt;&lt;P&gt;function _interopRequireDefault(obj) { return obj &amp;amp;&amp;amp; obj.__esModule ? obj : { default: obj }; }&lt;/P&gt;&lt;P&gt;class Car extends _react.default.Component {&lt;BR /&gt;render() {&lt;BR /&gt;return /*#__PURE__*/_react.default.createElement("h2", null, "**bleep**, World!");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;Is even posible?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 01:11:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-add-react-js-component-to-the-widget/m-p/1065840#M20935</guid>
      <dc:creator>LaurynasGedminas2</dc:creator>
      <dc:date>2021-06-08T01:11:24Z</dc:date>
    </item>
  </channel>
</rss>

