<?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 Issue with useRef hook in nebula.js 5.15.0 in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Issue-with-useRef-hook-in-nebula-js-5-15-0/m-p/2520615#M22264</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm currently developing an extension using Nebula.js version 5.15.0.&lt;/P&gt;&lt;P&gt;According to the documentation &lt;A href="https://qlik.dev/apis/javascript/nebula-js/#entries-useref" target="_blank" rel="noopener"&gt;https://qlik.dev/apis/javascript/nebula-js/#entries-useref&lt;/A&gt;, there's a useRef() hook available from @nebula.js/stardust. However, when I try to use it in my component, I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 579px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181187i6E17A01744891277/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Am I missing something here? Is there a different way to store mutable state across renders in Nebula.js?&lt;/P&gt;&lt;P&gt;For reference, here’s a snippet from my index.js:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { useElement, useLayout, useEffect, useApp, useSelections, useRef } from '@nebula.js/stardust';
import properties from './object-properties';
import data from './data';
import ext from './ext';
import { Utils } from './lib/utils';
import { Logger } from './lib/logger';
import { qlikHelper } from './lib/qlikHelper';
import { render, teardown } from './components/root';

/**
 * Entrypoint for your sense visualization
 * &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/120368"&gt;@param&lt;/a&gt; {object} galaxy Contains global settings from the environment.
 * Useful for cases when stardust hooks are unavailable (ie: outside the component function)
 * &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/120368"&gt;@param&lt;/a&gt; {object} galaxy.anything Extra environment dependent options
 * &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/120368"&gt;@param&lt;/a&gt; {object=} galaxy.anything.sense Optional object only present within Sense,
 * see: https://qlik.dev/extend/build-extension/in-qlik-sense
 */
export default function supernova(galaxy) {

  return {
    qae: {
      properties,
      data,
    },
    ext: ext(galaxy),
    component() {

      const utils = useRef(null);
      const logger = useRef(null);
      const isDev = useRef(false);
      const qlikApp = useRef(null);

      const el = useElement();
      const layout = useLayout();
      const app = useApp();
      const currSel = useSelections();

      useEffect(() =&amp;gt; {
        console.info('****** INITIAL FUNCTION *************************');
        utils.current = new Utils();
        isDev.current = utils.current.isDev();
        logger.current = new Logger(isDev.current);
        logger.current.log('isDev', isDev.current);
        qlikApp.current = new qlikHelper(app, layout, isDev.current, logger.current);
        return () =&amp;gt; {
          console.log('unmounted extension');
        }
      }, []);

      useEffect(() =&amp;gt; {
      
        //  some code...

        const root = render(el, { layout }, { app: qlikApp.current }, { data: data }, { utils: utils.current }, { logger: logger.current }, { isDev: isDev.current });
        return () =&amp;gt; {
          teardown(root);
        };
      }, [layout]);
    },
  };
}&lt;/LI-CODE&gt;&lt;P&gt;Any help or clarification would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;BR /&gt;Cristian&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jun 2025 15:00:32 GMT</pubDate>
    <dc:creator>cristian_dalsanto</dc:creator>
    <dc:date>2025-06-09T15:00:32Z</dc:date>
    <item>
      <title>Issue with useRef hook in nebula.js 5.15.0</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Issue-with-useRef-hook-in-nebula-js-5-15-0/m-p/2520615#M22264</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm currently developing an extension using Nebula.js version 5.15.0.&lt;/P&gt;&lt;P&gt;According to the documentation &lt;A href="https://qlik.dev/apis/javascript/nebula-js/#entries-useref" target="_blank" rel="noopener"&gt;https://qlik.dev/apis/javascript/nebula-js/#entries-useref&lt;/A&gt;, there's a useRef() hook available from @nebula.js/stardust. However, when I try to use it in my component, I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 579px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181187i6E17A01744891277/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Am I missing something here? Is there a different way to store mutable state across renders in Nebula.js?&lt;/P&gt;&lt;P&gt;For reference, here’s a snippet from my index.js:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { useElement, useLayout, useEffect, useApp, useSelections, useRef } from '@nebula.js/stardust';
import properties from './object-properties';
import data from './data';
import ext from './ext';
import { Utils } from './lib/utils';
import { Logger } from './lib/logger';
import { qlikHelper } from './lib/qlikHelper';
import { render, teardown } from './components/root';

/**
 * Entrypoint for your sense visualization
 * &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/120368"&gt;@param&lt;/a&gt; {object} galaxy Contains global settings from the environment.
 * Useful for cases when stardust hooks are unavailable (ie: outside the component function)
 * &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/120368"&gt;@param&lt;/a&gt; {object} galaxy.anything Extra environment dependent options
 * &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/120368"&gt;@param&lt;/a&gt; {object=} galaxy.anything.sense Optional object only present within Sense,
 * see: https://qlik.dev/extend/build-extension/in-qlik-sense
 */
export default function supernova(galaxy) {

  return {
    qae: {
      properties,
      data,
    },
    ext: ext(galaxy),
    component() {

      const utils = useRef(null);
      const logger = useRef(null);
      const isDev = useRef(false);
      const qlikApp = useRef(null);

      const el = useElement();
      const layout = useLayout();
      const app = useApp();
      const currSel = useSelections();

      useEffect(() =&amp;gt; {
        console.info('****** INITIAL FUNCTION *************************');
        utils.current = new Utils();
        isDev.current = utils.current.isDev();
        logger.current = new Logger(isDev.current);
        logger.current.log('isDev', isDev.current);
        qlikApp.current = new qlikHelper(app, layout, isDev.current, logger.current);
        return () =&amp;gt; {
          console.log('unmounted extension');
        }
      }, []);

      useEffect(() =&amp;gt; {
      
        //  some code...

        const root = render(el, { layout }, { app: qlikApp.current }, { data: data }, { utils: utils.current }, { logger: logger.current }, { isDev: isDev.current });
        return () =&amp;gt; {
          teardown(root);
        };
      }, [layout]);
    },
  };
}&lt;/LI-CODE&gt;&lt;P&gt;Any help or clarification would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;BR /&gt;Cristian&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 15:00:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Issue-with-useRef-hook-in-nebula-js-5-15-0/m-p/2520615#M22264</guid>
      <dc:creator>cristian_dalsanto</dc:creator>
      <dc:date>2025-06-09T15:00:32Z</dc:date>
    </item>
  </channel>
</rss>

