<?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: David Bain</title>
    <description>The latest articles on DEV Community by David Bain (@pigeonflight).</description>
    <link>https://dev.to/pigeonflight</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%2F460475%2F8cfd10fc-c43f-4ea6-9476-b2546509bc20.png</url>
      <title>DEV Community: David Bain</title>
      <link>https://dev.to/pigeonflight</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pigeonflight"/>
    <language>en</language>
    <item>
      <title>Learning Svelte by Converting a React Example</title>
      <dc:creator>David Bain</dc:creator>
      <pubDate>Mon, 23 Nov 2020 14:53:31 +0000</pubDate>
      <link>https://dev.to/pigeonflight/learning-svelte-by-converting-a-react-example-3582</link>
      <guid>https://dev.to/pigeonflight/learning-svelte-by-converting-a-react-example-3582</guid>
      <description>&lt;p&gt;To experiment with Svelte I decided to take some React demo code and re-implement it in Svelte. The goal was to re-implement the functionality using my current Svelte knowledge. It took a bit of reading around to get it right. Overall it took me 3 to 4 days on and off. Now that I have the experience under my belt, I can probably rebuild everything in 3 to 4 hours 🙂.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-projects-2-tours.netlify.app/"&gt;The original React app&lt;/a&gt; was created by John Smilga, a web developer from Los Angeles. BTW &lt;a href="https://www.youtube.com/watch?v=4UZrsTqkcW4"&gt;you really should check out his awesome React tutorial at youtube&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The app presents a listing of tours, I can imagine it being used as a component for a tour company.&lt;/p&gt;

&lt;p&gt;Here's what my version looks like:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mJflVaRi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0c2qc18xl04pj2y0wrbk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mJflVaRi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0c2qc18xl04pj2y0wrbk.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To save time and setup, I used the Svelte online Repl to create my version. You can &lt;a href="https://svelte.dev/repl/971eab9bc7574a3bafa466af86043997?version=3.29.7"&gt;interact with the live demo and source code through the Repl&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My version takes advantage of Svelte's &lt;a href="https://svelte.dev/tutorial/reactive-declarations"&gt;reactive declarations&lt;/a&gt;, &lt;a href="https://svelte.dev/tutorial/custom-stores"&gt;custom stores&lt;/a&gt; and &lt;a href="https://svelte.dev/tutorial/context-api"&gt;context API&lt;/a&gt;.&lt;br&gt;
I used Svelte stores to store and modify the array of tours. &lt;br&gt;
To dynamically manage the read more/show less button, I took advantage of Svelte's reactive declarations. Finally, I used Svelte's &lt;a href="https://svelte.dev/tutorial/context-api"&gt;context API - setContext, getContext&lt;/a&gt; to pass information between components.&lt;/p&gt;

&lt;p&gt;So far Svelte has been easy to think about. I like that it uses way less syntax than some of the competing approaches out there. I will do some more experimentation to decide if this is for me.&lt;/p&gt;

&lt;p&gt;But first, I hope to do a bit more work on this project to implement fetching from the API. Once I'm done, maybe a video tutorial? Who knows?&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
