<?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 Re: React: How to properly structure user generated rows w/ a DQL query in each? in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209624#M274</link>
    <description>&lt;P&gt;I changed the form component to execute the hook synchronously and put the result in the array of objects; this works with no issues. I originally wanted to store the hook in the array of objects and execute asynchronously. It seems like when I store the hook in an object it's no longer a hook.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 14:40:57 GMT</pubDate>
    <dc:creator>lucas_hocker</dc:creator>
    <dc:date>2023-04-12T14:40:57Z</dc:date>
    <item>
      <title>React: How to properly structure user generated rows w/ a DQL query in each?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209607#M270</link>
      <description>&lt;P&gt;I would like my app to have a set of user generated rows, ie table starts empty then user clicks '+', fills out a form, and a row is generated with their data. Each row should also query Grail using DQL based on the user's input in the form. I seem to be a bit confused on where to use pure objects, components, and hooks to structure this effectively.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Option 1 - array of pure objects&lt;/STRONG&gt;&lt;BR /&gt;In my first attempt, I stored the user's form data in an array of pure objects and rendered with DataTable. When I added a hook to query DQL as another object property, I ran into issues with state not updating.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Option 2 - two arrays: one of pure objects and one of DQL hooks&lt;/STRONG&gt;&lt;BR /&gt;Another thought was to keep this array of pure objects for the user input but push the new hook on to an array. This seemed messy when it came to cross-linking or trying to maintain array order.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Option 3 - 1 hook with an array of queries in it&lt;/STRONG&gt;&lt;BR /&gt;Another variant would be storing the array of queries in a single hook invocation. I think this might resolve the state issues, but it makes handling state within the hook messy, e.g. tracking query, running, error, result, etc for each query.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Option 4 - 1 array of components&lt;/STRONG&gt;&lt;BR /&gt;When user fills out form, a Row component is created with its own useDQL hook. Row is inserted into an array. DataTable somehow renders a memoized version of this array.&lt;/P&gt;
&lt;P&gt;Could you please point me in the right direction?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 07:39:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209607#M270</guid>
      <dc:creator>lucas_hocker</dc:creator>
      <dc:date>2023-04-20T07:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: React: How to properly structure user generated rows w/ a DQL query in each?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209612#M271</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/32376"&gt;@lucas_hocker&lt;/a&gt;, I don't quite understand the first option's approach. What do you mean by "added a hook to query DQL&amp;nbsp;&lt;STRONG&gt;as another object property&lt;/STRONG&gt;"? The rest of the options seem too complex. Can you please share some code? Maybe I can spot what's causing the state issue.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 13:00:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209612#M271</guid>
      <dc:creator>educampver</dc:creator>
      <dc:date>2023-04-12T13:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: React: How to properly structure user generated rows w/ a DQL query in each?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209616#M272</link>
      <description>&lt;P&gt;Adding a new row from Button click:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-04-12 at 3.08.59 PM.png" style="width: 850px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11087iE115323CC9CDD042/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-04-12 at 3.08.59 PM.png" alt="Screenshot 2023-04-12 at 3.08.59 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Inside hook:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-04-12 at 3.12.41 PM.png" style="width: 725px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11089i4F7E361B05CC0CF3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-04-12 at 3.12.41 PM.png" alt="Screenshot 2023-04-12 at 3.12.41 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Display:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-04-12 at 3.09.50 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11088i118B49F50EC264A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-04-12 at 3.09.50 PM.png" alt="Screenshot 2023-04-12 at 3.09.50 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From console I can see "Fire setFilter" from the button click; however, "Filter changed:" is never seen, so the useEffect inside the hook never fires.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 13:15:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209616#M272</guid>
      <dc:creator>lucas_hocker</dc:creator>
      <dc:date>2023-04-12T13:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: React: How to properly structure user generated rows w/ a DQL query in each?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209621#M273</link>
      <description>&lt;P&gt;I suspect the issue might be in the form component. I can't see where the new group values are coming from or how they're updated. Can you share more code from that component?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 13:46:25 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209621#M273</guid>
      <dc:creator>educampver</dc:creator>
      <dc:date>2023-04-12T13:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: React: How to properly structure user generated rows w/ a DQL query in each?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209624#M274</link>
      <description>&lt;P&gt;I changed the form component to execute the hook synchronously and put the result in the array of objects; this works with no issues. I originally wanted to store the hook in the array of objects and execute asynchronously. It seems like when I store the hook in an object it's no longer a hook.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 14:40:57 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/React-How-to-properly-structure-user-generated-rows-w-a-DQL/m-p/209624#M274</guid>
      <dc:creator>lucas_hocker</dc:creator>
      <dc:date>2023-04-12T14:40:57Z</dc:date>
    </item>
  </channel>
</rss>

