<?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: A</title>
    <description>The latest articles on DEV Community by A (@jsar382).</description>
    <link>https://dev.to/jsar382</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%2F1304936%2F2093caf7-27b6-45d0-a0a5-db3c5b1ccf4a.png</url>
      <title>DEV Community: A</title>
      <link>https://dev.to/jsar382</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jsar382"/>
    <language>en</language>
    <item>
      <title>React - designing an interactive modal</title>
      <dc:creator>A</dc:creator>
      <pubDate>Mon, 26 Feb 2024 21:14:49 +0000</pubDate>
      <link>https://dev.to/jsar382/react-designing-an-interactive-modal-39l9</link>
      <guid>https://dev.to/jsar382/react-designing-an-interactive-modal-39l9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;: I'm creating a game in React. What's the best way to structure the app in a way that I can render a series of interactive modals?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
Player taps on a location on a map. As they move to the location, they'll encounter 0 to X other people on the way.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;These encounters will have interactive elements that determine how the encounter is resolved.&lt;/li&gt;
&lt;li&gt;Each one of those encounters may influence the ones after it (for example, I might conduct a trade, and subsequent encounters may decide to ignore me after).&lt;/li&gt;
&lt;li&gt;Let's say there's 3 types of encounters. As I resolve each one, I'll see the next one until I arrive at my destination.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I've thought of a couple ways to do this but wondering what the "best practice" is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate a list of potential encounters in a Game component, and pass it to a "Travel" component that conditionally renders text based off which type of encounter.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do the same as above, but then create/destroy the Travel component as each one is resolved.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Have a "Travel" component generate the encounters, and then do the same conditional rendering.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any other ideas? &lt;/p&gt;

</description>
      <category>react</category>
      <category>gamedev</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
