<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Manan Joshi on Medium]]></title>
        <description><![CDATA[Stories by Manan Joshi on Medium]]></description>
        <link>https://medium.com/@Manan_30?source=rss-d0bdd5ea420a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gHf4JJr_lJvt8URVPeZYLw.jpeg</url>
            <title>Stories by Manan Joshi on Medium</title>
            <link>https://medium.com/@Manan_30?source=rss-d0bdd5ea420a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:07:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Manan_30/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I created a Quiz app using Svelte and now I cannot go back to any other framework.]]></title>
            <link>https://javascript.plainenglish.io/i-created-a-quiz-app-using-svelte-and-now-i-cannot-go-back-to-any-other-framework-3308fc87e7d?source=rss-d0bdd5ea420a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3308fc87e7d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[svelte]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Manan Joshi]]></dc:creator>
            <pubDate>Sun, 24 Nov 2019 05:28:03 GMT</pubDate>
            <atom:updated>2019-12-01T17:28:36.095Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="svelte-trivia-demo" src="https://cdn-images-1.medium.com/max/1000/1*XC7ICcWZxu5Yk5q7Pu7-Xg.png" /><figcaption>svelte-trivia-demo</figcaption></figure><blockquote><strong><em>Update:</em></strong> I have updated this project with animations and corrected the logic behind the app. You can find the most up to date version <a href="https://github.com/manan30/svelte-trivia">here</a> and the live <a href="https://manan30.github.io/svelte-trivia/">demo</a>.</blockquote><p>I was hearing about <strong>Svelte</strong> a lot and after listening to this <a href="https://www.youtube.com/watch?v=AdNJ3fydeao">talk</a> I wanted to give it a try too. So I did and it turns out that Svelte is super amazing. I am used to programming with <strong>React</strong> a lot and some clear differences made me fall in love with Svelte.</p><h3>What is Svelte</h3><p><a href="https://svelte.dev/">Svelte</a> is a compiler that converts our declarative component-based code into JavaScript that can manipulate the DOM directly. You might have heard that Svelte is blazing fast, faster than any other framework out there and that is true. The reason behind this is because of the very fact that Svelte is more of a compiler than a framework or a library. Svelte does not use a Shadow DOM or a Virtual DOM to perform DOM updates, naturally making it orders of magnitude faster than frameworks or libraries that ship with a virtual DOM implementation. It tries to eliminate a lot of boilerplate code and is truly reactive. If you are coming from a React ecosystem like me, Svelte challenges the way you think in a lot of ways.</p><p>In this article, we will create a small trivia app and see how Svelte compares to React.</p><p>Let’s start by creating a Svelte project first. Svelte just like create-react-app provides a way to bootstrap a Svelte app. Just run the code below to get up and running.</p><pre>npx degit sveltejs/template my-svelte-project <br>cd my-svelte-project <br>npm install <br>npm run dev</pre><p>Our project directory should look something like this.</p><figure><img alt="project-structure" src="https://cdn-images-1.medium.com/max/580/0*GFIcSyJCRbysLfs2.png" /></figure><p>Now, if you open up package.json you&#39;ll see something amazing.</p><figure><img alt="package.json" src="https://cdn-images-1.medium.com/max/880/0*4SzY-_T2iyq7mPxT.png" /></figure><p>It does not have any dependencies listed. All the dependencies are devDependencies. This is because Svelte is a compiler and all the dependencies are computed beforehand while generating the build and hence our final code doesn&#39;t ship with any of those dependencies making our build size much much smaller.</p><ul><li>The main.js file is our main entry point into the application. It is like the App.js file in a React project.</li><li>We also see the App.svelte file. Let&#39;s open the file and understand the different parts of it.</li><li>If you are familiar with React we know that we usually end our React specific files with a .jsx extension. Similarly in Svelte, all our Svelte specific files end with a .svelte extension.</li><li>Each Svelte file contains either just markup (HTML tags) or markup with styles enclosed in the &lt;style&gt;&lt;/style&gt; tag or JavaScript enclosed in &lt;script&gt;&lt;/script&gt; tag or all three of them.</li><li>The best part about the Svelte component is that the styles inside of them are scoped to that component only and hence you won’t run into an issue where the styles would leak into some other component.</li><li>If you are used to writing <strong>HTML in JS</strong> with JSX, Svelte is the exact opposite of that and you write everything in a svelte file which is just syntactic sugar for writing HTML files.</li></ul><p><strong>Note: If you are coming from a React background you might not be used to thinking this way but believe me this is going to help you expand your boundaries.</strong></p><p>With that being said let’s start.</p><p>First, we are going to look at the App.svelte file. This is our main file/component which serves as the entry point for the app. You can use the code below for your reference.</p><pre>&lt;script&gt;<br>  // import QuizArea from &#39;./QuizArea.svelte&#39;;<br>&lt;/script&gt;<br><br>&lt;style&gt;<br>  main {<br>    text-align: center;<br>    padding: 1em;<br>    max-width: 240px;<br>    margin: 0 auto;<br>  }<br><br>  h1 {<br>    text-transform: uppercase;<br>    font-size: 4em;<br>    font-weight: 100;<br>  }<br><br>  @media (min-width: 640px) {<br>    main {<br>      max-width: none;<br>    }<br>  }<br>&lt;/style&gt;<br><br>&lt;main&gt;<br>  &lt;!-- &lt;QuizArea&gt;&lt;/QuizArea&gt; --&gt;<br>&lt;/main&gt;</pre><ul><li>As you can see in the code, we have the script, style and markup for the component. At this point, the code does nothing fancy other than just applying some styles to the app.</li><li>But soon we’ll uncomment the QuizArea component.</li></ul><p>I hope that you have gotten a basic idea of the different parts in a Svelte file/component.</p><p>I have not added all the files from the project in this post but if you would like to reference the code at any moment it is available <a href="https://github.com/manan30/svelte-trivia">here</a>.</p><p>Now, let’s create a new QuizArea component. For that create a file called QuizArea.svelte in the <strong>src</strong> directory.</p><p>We’ll look at each of the three parts separately.</p><ul><li>First up we have the &lt;styles&gt;&lt;/styles&gt; tag. You can add any styles that you want for that component in between the &lt;style&gt; tag.</li><li>Instead of writing CSS in a separate file, in Svelte we write the styles within the component itself.</li><li>I have defined styles for the QuizArea component in the code below, but you can style it the way you want it.</li></ul><pre>&lt;style&gt;<br>  #main {<br>    position: absolute;<br>    left: 50%;<br>    top: 50%;<br>    transform: translateX(-50%) translateY(-50%);<br>    height: calc(100vh - 40%);<br>    width: calc(100vw - 40%);<br>    padding: 15px;<br><br>    background-color: white;<br>    border-radius: 6px;<br>    box-shadow: 0 0 5px white;<br><br>    text-align: left;<br>  }<br><br>  span {<br>    display: block;<br>    margin-top: 20px;<br>  }<br><br>  button {<br>    margin-top: 15px;<br>    margin-right: 15px;<br>    padding: 10px;<br>    float: right;<br><br>    color: white;<br>    background-color: #ff3e00;<br>    border: none;<br>    border-radius: 10px;<br>    cursor: pointer;<br>  }<br><br>  button:hover {<br>    box-shadow: 0 0 5px #ff3e00;<br>  }<br><br>  #heading {<br>    font-size: 24px;<br>    font-weight: bolder;<br>  }<br><br>  #difficulty {<br>    position: absolute;<br>    right: 16px;<br>    top: 16px;<br>    height: 25px;<br>    width: 80px;<br>    padding: 5px;<br><br>    background: rgb(97, 225, 230);<br>    color: white;<br>    text-align: center;<br>    border-radius: 16px;<br>  }<br><br>  #category {<br>    font-size: 12px;<br>    font-weight: normal;<br>  }<br><br>  #button-bar {<br>    position: absolute;<br>    bottom: 16px;<br>    right: 0;<br>  }<br><br>  #choice {<br>    margin-top: 16px;<br>    padding: 8px;<br><br>    border: 1px solid #4e5656;<br>    border-radius: 8px;<br>  }<br><br>  #choice:hover {<br>    cursor: pointer;<br>    background: green;<br>    border: 1px solid green;<br>    color: white;<br>  }<br><br>  #snackbar {<br>    position: absolute;<br>    left: 16px;<br>    bottom: 16px;<br>  }<br>&lt;/style&gt;</pre><p>This was easy, nothing fancy or Svelte specific. The only thing is we write styles in the same file as the other component code.</p><ul><li>Next up we are going to talk about the &lt;script&gt;&lt;/script&gt; tag. We&#39;ll be writing all our JavaScript inside of this tag and here is where we&#39;ll be looking at how Svelte does things.</li><li>So, in Svelte we’ll be using let or const to declare variables. All the variables that we declare are essential state variables. And all the rules of JavaScript apply to these variables, so const variables cannot be reassigned while let variables can be reassigned.</li><li>They are the same as the variables that we declare using useState() in React.</li><li>The best part about Svelte is that the component automatically re-renders whenever the value of state variable changes. But there is no need to call any set function.</li></ul><pre>// In Svelte<br>let name = &#39;Manan&#39;;<br><br>// Same thing in React<br>const [name, setName] = React.useState(&#39;Manan&#39;);<br><br>// causes component to re-render<br>name = &#39;Maitry&#39;;<br><br>// Same thing in React<br>setName(&#39;Maitry&#39;);</pre><ul><li>We have talked about state so it&#39;s natural that we talk about props. In Svelte, you can declare a prop by just adding the export keyword behind the variable declaration.</li></ul><pre>// props in Svelte<br>export let name;</pre><ul><li>The name prop can now be used in other components. We can declare any number of props as we do it in React.</li><li>We can even declare functions that can act as our event handlers or can serve any other purpose like fetching data, providing utility operations, etc.</li></ul><pre>// on click handler<br>function handleClick(change) {<br>  snackbarVisibility = false;<br><br>  if (change === &#39;f&#39;) questionNo += 1;<br>  else questionNo -= 1;<br><br>  question = htmlDecode(data[questionNo].question);<br>  answerChoices = shuffle(<br>    [<br>      ...data[questionNo].incorrect_answers,<br>      data[questionNo].correct_answer<br>    ].map(a =&gt; htmlDecode(a))<br>  );<br>  answer = htmlDecode(data[questionNo].correct_answer);<br>  category = htmlDecode(data[questionNo].category);<br>  difficulty = data[questionNo].difficulty;<br>}</pre><ul><li>We can import other modules or packages or components by using the import keyword. This is similar to what we do in React.</li></ul><pre>// imports the Snackbar component<br>import Snackbar from &#39;./Snackbar.svelte&#39;;</pre><p>The main takeaway from this part is that we can write whatever JavaScipt we want with a few twists and the compiler will do the rest for us.</p><p>Now the question is how can we use our JavaScript variables in the HTML markup. So for the final part of the app, we will look into that.</p><ul><li>It is pretty simple to render any variable. We just wrap the variable in curly braces like this {variableName}.</li></ul><pre>&lt;!-- see how simple it is :smiley:--&gt;<br>&lt;p&gt;Hello {name}!&lt;/p&gt;<br><br>&lt;!-- outputs --&gt;<br>Hello Manan</pre><ul><li>Remember the markup inside a Svelte file is Html-ish and hence we can use built-in Svelte expressions to perform things like rendering something conditionally or looping over given values.</li><li>To render something conditionally we use {#if expression}&lt;div&gt;&lt;/div&gt; {/if}. Here the expression can be any valid variable or expression that is in scope (i.e declared inside the &lt;script&gt; tag)</li></ul><pre>{#if name}<br>&lt;div id=&quot;snackbar&quot;&gt;<br>  &lt;Snackbar message=&quot;{correct}&quot;&gt;&lt;/Snackbar&gt;<br>&lt;/div&gt;<br>{/if}</pre><ul><li>To loop over an array we use the {#each expression as exp}&lt;div&gt;&lt;/div&gt;{/each}. Here the expression is an iterable value while exp is each entry of that iterable value.</li></ul><pre>{#each answerChoices as choice}<br>&lt;div id=&quot;choice&quot; on:click=&quot;{(e) =&gt; handleAnswerChoice(e)}&quot;&gt;<br>  &lt;i&gt;{choice}&lt;/i&gt;<br>&lt;/div&gt;<br>{/each}</pre><p>This is just the tip of the iceberg and you can learn more about everything that Svelte can do over <a href="https://svelte.dev/docs">here</a>.</p><p>With this, we can now stitch our component together. Copy and paste the code given below in your QuizArea.svelte file</p><pre>&lt;script&gt;<br>  import { onMount } from &#39;svelte&#39;;<br>  import { htmlDecode, shuffle } from &#39;./utils.js&#39;;<br>  import Snackbar from &#39;./Snackbar.svelte&#39;;<br><br>  let data;<br><br>  let questionNo = 0;<br>  let question = &#39;loading...&#39;;<br>  let answerChoices;<br>  let answer;<br>  let category = &#39;loading...&#39;;<br>  let difficulty = &#39;loading...&#39;;<br><br>  let correct = false;<br>  let snackbarVisibility = false;<br>  $: score = 0;<br><br>  // function for fetching data<br>  function fetchData() {<br>    fetch(&#39;https://opentdb.com/api.php?amount=10&#39;)<br>      .then(resp =&gt; resp.json())<br>      .then(res =&gt; {<br>        data = res.results;<br>        question = htmlDecode(data[questionNo].question);<br>        answerChoices = shuffle(<br>          [<br>            ...data[questionNo].incorrect_answers,<br>            data[questionNo].correct_answer<br>          ].map(a =&gt; htmlDecode(a))<br>        );<br>        answer = htmlDecode(data[questionNo].correct_answer);<br>        category = htmlDecode(data[questionNo].category);<br>        difficulty = data[questionNo].difficulty;<br>      })<br>      .catch(e =&gt; console.error(e));<br>  }<br><br>  onMount(fetchData);<br><br>  // function for moving onto next/prev question<br>  function handleClick(change) {<br>    snackbarVisibility = false;<br><br>    if (change === &#39;f&#39;) questionNo += 1;<br>    else questionNo -= 1;<br><br>    question = htmlDecode(data[questionNo].question);<br>    answerChoices = shuffle(<br>      [<br>        ...data[questionNo].incorrect_answers,<br>        data[questionNo].correct_answer<br>      ].map(a =&gt; htmlDecode(a))<br>    );<br>    answer = htmlDecode(data[questionNo].correct_answer);<br>    category = htmlDecode(data[questionNo].category);<br>    difficulty = data[questionNo].difficulty;<br>  }<br><br>  // function to check the correctness of an answer<br>  function handleAnswerChoice(e) {<br>    if (e.target.innerText === answer &amp;&amp; !correct) {<br>      correct = true;<br>      score += 1;<br>    } else if (correct) correct = false;<br>    snackbarVisibility = true;<br>  }<br>&lt;/script&gt;<br><br>&lt;style&gt;<br>  #main {<br>    position: absolute;<br>    left: 50%;<br>    top: 50%;<br>    transform: translateX(-50%) translateY(-50%);<br>    height: calc(100vh - 40%);<br>    width: calc(100vw - 40%);<br>    padding: 15px;<br><br>    background-color: white;<br>    border-radius: 6px;<br>    box-shadow: 0 0 5px white;<br><br>    text-align: left;<br>  }<br><br>  span {<br>    display: block;<br>    margin-top: 20px;<br>  }<br><br>  button {<br>    margin-top: 15px;<br>    margin-right: 15px;<br>    padding: 10px;<br>    float: right;<br><br>    color: white;<br>    background-color: #ff3e00;<br>    border: none;<br>    border-radius: 10px;<br>    cursor: pointer;<br>  }<br><br>  button:hover {<br>    box-shadow: 0 0 5px #ff3e00;<br>  }<br><br>  #heading {<br>    font-size: 24px;<br>    font-weight: bolder;<br>  }<br><br>  #difficulty {<br>    position: absolute;<br>    right: 16px;<br>    top: 16px;<br>    height: 25px;<br>    width: 80px;<br>    padding: 5px;<br><br>    background: rgb(97, 225, 230);<br>    color: white;<br>    text-align: center;<br>    border-radius: 16px;<br>  }<br><br>  #category {<br>    font-size: 12px;<br>    font-weight: normal;<br>  }<br><br>  #button-bar {<br>    position: absolute;<br>    bottom: 16px;<br>    right: 0;<br>  }<br><br>  #choice {<br>    margin-top: 16px;<br>    padding: 8px;<br><br>    border: 1px solid #4e5656;<br>    border-radius: 8px;<br>  }<br><br>  #choice:hover {<br>    cursor: pointer;<br>    background: green;<br>    border: 1px solid green;<br>    color: white;<br>  }<br><br>  #snackbar {<br>    position: absolute;<br>    left: 16px;<br>    bottom: 16px;<br>  }<br><br>  @media screen and (max-width: 960px) {<br>    #main {<br>      width: calc(100vw - 15%);<br>    }<br>    #difficulty {<br>      top: -16px;<br>    }<br>  }<br>&lt;/style&gt;<br><br>&lt;div id=&quot;main&quot;&gt;<br>  &lt;span id=&quot;heading&quot;<br>    &gt;Question {questionNo + 1}<br>    &lt;i id=&quot;category&quot;&gt;(Category - {category})&lt;/i&gt;&lt;/span<br>  &gt;<br>  &lt;span&gt;{question}&lt;/span&gt;<br>  &lt;div id=&quot;difficulty&quot;&gt;{difficulty}&lt;/div&gt;<br><br>  {#if answerChoices} {#each answerChoices as choice}<br>  &lt;div id=&quot;choice&quot; on:click=&quot;{(e) =&gt; handleAnswerChoice(e)}&quot;&gt;<br>    &lt;i&gt;{choice}&lt;/i&gt;<br>  &lt;/div&gt;<br>  {/each} {/if}<br><br>  &lt;div id=&quot;button-bar&quot;&gt;<br>    {#if !(questionNo &gt; 10)}<br>    &lt;button value=&quot;Next&quot; on:click=&quot;{() =&gt; handleClick(&#39;f&#39;)}&quot;&gt;Next&lt;/button&gt;<br>    {/if} {#if questionNo &gt; 0}<br>    &lt;button value=&quot;Back&quot; on:click=&quot;{() =&gt; handleClick(&#39;b&#39;)}&quot;&gt;<br>      Previous<br>    &lt;/button&gt;<br>    {/if}<br>  &lt;/div&gt;<br><br>  {#if snackbarVisibility}<br>  &lt;div id=&quot;snackbar&quot;&gt;<br>    &lt;Snackbar message=&quot;{correct}&quot;&gt;&lt;/Snackbar&gt;<br>  &lt;/div&gt;<br>  {/if}<br>&lt;/div&gt;</pre><p>And there we have it an app written completely in Svelte. Go ahead and use npm run dev to see your app in action. This is a really small app that demonstrates what we can do with Svelte and for me, this might revolutionize the way we design for the web and I am very much excited about what&#39;s ahead in store for us.</p><p>The main goal of this article was to give you an overview of Svelte and how awesome it is. I hope you feel a little bit more comfortable about using Svelte now.</p><h3>Thoughts 💭</h3><p>Please let me know your thoughts about Svelte in the discussion section below. Also, don’t hesitate to ask any questions if you are stuck somewhere in the app or would like to learn more about it or are confused about any part.</p><p>Thank you for reading!</p><p>As always, connect with me on <a href="https://twitter.com/Manan_30">Twitter</a> and <a href="https://www.instagram.com/manan__joshi/">Instagram</a>.</p><p>Until next time, peace out and happy coding !!!</p><p>Cheers.</p><p><em>Originally published at </em><a href="https://dev.to/manan30/i-created-a-quiz-app-using-svelte-and-now-i-cannot-go-back-to-any-other-framework-1jeo"><em>https://dev.to</em></a><em> on November 24, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3308fc87e7d" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/i-created-a-quiz-app-using-svelte-and-now-i-cannot-go-back-to-any-other-framework-3308fc87e7d">I created a Quiz app using Svelte and now I cannot go back to any other framework.</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a searchable movie app using React, styled-components and React Hooks]]></title>
            <link>https://javascript.plainenglish.io/creating-a-searchable-movie-app-using-react-styled-components-and-react-hooks-8d149611d05c?source=rss-d0bdd5ea420a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d149611d05c</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Manan Joshi]]></dc:creator>
            <pubDate>Thu, 14 Nov 2019 21:11:47 GMT</pubDate>
            <atom:updated>2019-11-16T10:18:15.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Screenshot of the app" src="https://cdn-images-1.medium.com/max/1000/0*v8f4s_aS7BdLolSz.png" /></figure><p>With React Hooks becoming the new normal, they have certainly got me more hooked on to React. The other day I was commenting on a post <a href="https://dev.to/manan30/comment/hk8a">here</a> and figured I should write this article. In this article, we will be creating a small searchable movie database using the <a href="https://www.themoviedb.org/">TMDb API</a> completely using React hooks. We will also see how we can create 100% reusable components. So without any further delay, let’s get started.</p><h3>Project Setup</h3><p>Let’s create a new react app. The best way to do this is by using npx create-react-app movie-database. Next, we want to install styled-components for styling our app and axios to make network requests. Install them by using npm i axios styled-components or yarn add axios styled-components.</p><p>With our project dependencies installed, let’s generate a key <a href="https://developers.themoviedb.org/3/getting-started/introduction">here</a> to access the TMDb API. Since the link at the top has detailed steps I am not going to go through the steps here. But, if you feel stuck at any of the steps, feel free to drop a comment below.</p><p>I hope you were successfully able to generate a key! Please copy the key and paste it somewhere we will need that key in some time.</p><h3>Overview</h3><p>Now with our project all set up. Let’s understand how things are going to work and what kind of hooks we will use. First up, some basic intro to hooks. Traditionally we have thought of functional components to be dumb components that don’t have their state and life-cycle methods. Hence, this did not allow us to make efficient reusable components and class components, on the other hand, had a lot of boiler-plate associated with them even to perform a simple operation. But, hooks change our way of thinking completely. With hooks, we can make any functional component stateful and even perform life-cycle operations inside it. In this article we will be looking at two React hooks namely useState and useEffect. The useState hook allows us to add state variables to our functional components while useEffect helps in achieving the tasks that we normally do in life-cycle methods. React also allows us to define our custom hooks but more on this later. Read more about React hooks <a href="https://reactjs.org/docs/hooks-overview.html">here</a>.</p><p>Also, we will be using <a href="https://www.styled-components.com/">styled-components</a> for styling the app but you can use CSS or any other preprocessor.</p><p>So, let’s start creating a few components. First up we are going to create a grid component that is going to display all the movies. Create a directory called Grid and add in the index.js and styled.js files.</p><h3>Grid Component</h3><h4>Grid/index.js</h4><pre>import React from &#39;react&#39;;<br>import PropTypes from &#39;prop-types&#39;;<br><br>import GridItem from &#39;../Item&#39;;<br><br>import GridContainer from &#39;./styled&#39;;<br><br>import Constants from &#39;../../utils/Constants&#39;;<br><br>function Grid({ items }) {<br>  return (<br>    &lt;GridContainer&gt;<br>      {items.map((item, i) =&gt; {<br>        const idx = i;<br>        return (<br>          &lt;GridItem<br>            key={idx}<br>            title={item.title}<br>            image={`${Constants.IMAGE_URL}/${item.poster_path}`}<br>            overview={item.overview}<br>            ratings={item.vote_average}<br>          /&gt;<br>        );<br>      })}<br>    &lt;/GridContainer&gt;<br>  );<br>}<br><br>Grid.propTypes = {<br>  items: PropTypes.arrayOf(PropTypes.any)<br>};<br><br>Grid.defaultProps = {<br>  items: []<br>};<br><br>export default Grid;</pre><h4>Grid/styled.js</h4><pre>import styled from &#39;styled-components&#39;;<br><br>const GridContainer = styled.div`<br>  display: flex;<br>  width: 100%;<br>  flex-direction: row;<br>  flex-wrap: wrap;<br>`;<br><br>export default GridContainer;</pre><ul><li>Let’s see how this component works. The Grid component will create an N X Ngrid based on the width of its children. The only thing you need to pass in is an array of items. And here it is your first reusable component. You can use this Grid in any project. You can pass in props or use any other component as its children.</li><li>In this example, I have created a GridItem component as the child for the Grid. The code for the GridITem component is below. Create a directory called GridItem and add in the index.js and styled.js files.</li></ul><h3>GridItem component</h3><h4>GridItem/index.js</h4><pre>import React from &#39;react&#39;;<br>import PropTypes from &#39;prop-types&#39;;<br><br>import {<br>  Container,<br>  Content,<br>  Image,<br>  Text,<br>  FAB,<br>  Separator,<br>  Button<br>} from &#39;./styled&#39;;<br><br>function Item({ image, title, overview, ratings }) {<br>  return (<br>    &lt;Container&gt;<br>      &lt;Image image={image} /&gt;<br>      &lt;Content&gt;<br>        &lt;Text weight=&#39;bolder&#39; relative&gt;<br>          {title}<br>        &lt;/Text&gt;<br>        &lt;Text color=&#39;#BFC0CE&#39; height&gt;<br>          {overview}<br>        &lt;/Text&gt;<br>        &lt;FAB&gt;{ratings}&lt;/FAB&gt;<br>        &lt;Separator /&gt;<br>        &lt;Button&gt;Details&lt;/Button&gt;<br>      &lt;/Content&gt;<br>    &lt;/Container&gt;<br>  );<br>}<br><br>Item.propTypes = {<br>  image: PropTypes.string,<br>  title: &quot;PropTypes.string,&quot;<br>  overview: PropTypes.string,<br>  ratings: PropTypes.string<br>};<br><br>Item.defaultProps = {<br>  image: &#39;&#39;,<br>  title: &quot;&#39;&#39;,&quot;<br>  overview: &#39;&#39;,<br>  ratings: &#39;&#39;<br>};<br><br>export default Item;</pre><h4>GridItem/styled.js</h4><pre>import styled from &#39;styled-components&#39;;<br><br>const Container = styled.div`<br>  display: inline-flex;<br>  height: 150px;<br>  width: calc(50% - 45px);<br>  margin-top: 16px;<br>  margin-bottom: 20px;<br>  margin-right: 15px;<br>  padding: 15px;<br>  background: white;<br>  box-shadow: 10px 5px 15px #e0e5ec;<br>`;<br><br>const Image = styled.div`<br>  height: 128px;<br>  width: 90px;<br>  margin-top: -32px;<br>  background-color: white;<br>  background-image: url(https://medium.com/$%7Bprops%20=&gt;%20props.image%20&amp;&amp;%20props.image%7D);<br>  background-position: center center;<br>  background-repeat: no-repeat;<br>  background-size: cover;<br>  box-shadow: 3px 2px 4px #dbdee3;<br>`;<br><br>const Content = styled.div`<br>  height: 100%;<br>  width: 100%;<br>  margin-left: 20px;<br>  margin-top: 5px;<br>  margin-bottom: 15px;<br>`;<br><br>const Text = styled.div`<br>  position: relative;<br>  margin-bottom: 15px;<br>  height: ${props =&gt; props.height &amp;&amp; &#39;3.6em&#39;};<br>  font-size: ${props =&gt; (props.size &amp;&amp; props.size) || &#39;16px&#39;};<br>  font-weight: ${props =&gt; (props.weight &amp;&amp; props.weight) || &#39;&#39;};<br>  color: ${props =&gt; (props.color &amp;&amp; props.color) || &#39;#9D9FB0&#39;};<br>  overflow: hidden;<br>  ::after {<br>    content: &#39;&#39;;<br>    text-align: right;<br>    position: absolute;<br>    bottom: 0;<br>    right: 0;<br>    width: ${props =&gt; (props.relative &amp;&amp; &#39;0&#39;) || &#39;40%&#39;};<br>    height: 1.2em;<br>    background: linear-gradient(<br>      to right,<br>      rgba(255, 255, 255, 0),<br>      rgba(255, 255, 255, 1) 50%<br>    );<br>  }<br>`;<br><br>const FAB = styled.div`<br>  display: flex;<br>  height: 48px;<br>  width: 48px;<br>  margin-top: -150px;<br>  border-radius: 50%;<br>  float: right;<br>  color: white;<br>  box-shadow: 4px 4px 10px #c9d8db;<br>  background-color: #2879ff;<br>  align-items: center;<br>  justify-content: center;<br>  font-size: 14px;<br>  font-weight: bold;<br>`;<br><br>const Separator = styled.hr`<br>  position: relative;<br>  height: 2px;<br>  margin: 10px 0;<br>  background: #f2f4f8;<br>  border: none;<br>`;<br><br>const Button = styled.div`<br>  display: flex;<br>  width: 64px;<br>  padding: 5px;<br>  margin-right: 5px;<br>  float: right;<br>  justify-content: center;<br>  align-items: center;<br>  font-size: 12px;<br>  border-radius: 10px;<br>  border: 2px solid #2879ff;<br>  color: #2879ff;<br>  cursor: pointer;<br>  :hover {<br>    background: #2879ff;<br>    color: white;<br>    box-shadow: 2px 0 7px #c9d8db;<br>  }<br>`;<br><br>export { Container, Content, Image, Text, FAB, Separator, Button };</pre><p>With our Grid component in place, let’s fetch some data to display. We’ll be using axios to fetch data from the TMDb API. Time to bring out the API key that we had created earlier.</p><p>Let’s create a file called API.js and use the code below.</p><h3>API.js</h3><pre>import axios from &#39;axios&#39;;<br><br>const movies = type =&gt; {<br>  return axios.get(<br>    `${Constants.REQUEST_URL}/movie/${type}?api_key=${Constants.API_KEY}`<br>  );<br>};<br><br>export default { movies };</pre><p>Let’s now tie everything together in our view and see hooks in action. Create a directory called Main and add the two files shown below. This is our main view and our movie grid will be shown here.</p><h3>Main View</h3><h4>Main/styled.js</h4><pre>import styled from &#39;styled-components&#39;;<br><br>const RootContainer = styled.div`<br>  height: 100vh;<br>  width: 100vw;<br>  display: inline-flex;<br>`;<br>const SideBarSection = styled.section`<br>  width: 20%;<br>  background-color: white;<br>  box-shadow: 3px 0 15px #e5e9f0;<br>`;<br><br>const ContentSection = styled.div`<br>  height: 100%;<br>  width: 100%;<br>`;<br><br>const SearchBarSection = styled.section`<br>  height: 38px;<br>  width: 256px;<br>  margin: 10px 0;<br>  padding: 0 20px;<br>`;<br><br>const MoviesGridSection = styled.section`<br>  height: calc(100% - 88px);<br>  width: calc(100% - 28px);<br>  padding: 20px;<br>  overflow-y: scroll;<br>`;<br><br>export {<br>  RootContainer,<br>  SideBarSection,<br>  ContentSection,<br>  SearchBarSection,<br>  MoviesGridSection<br>};</pre><h4>Main/index.js</h4><pre>import React, { useState, useEffect } from &#39;react&#39;;<br><br>import Search from &#39;../../components/Search&#39;;<br>import MoviesGrid from &#39;../../components/Grid&#39;;<br><br>import Get from &#39;../../api/Get&#39;;<br>import Constants from &#39;../../utils/Constants&#39;;<br>import useSearch from &#39;../../hooks/useSearch&#39;;<br><br>import {<br>  RootContainer,<br>  ContentSection,<br>  MoviesGridSection,<br>  SearchBarSection<br>} from &#39;./styled&#39;;<br><br>Constants.FuseOptions.keys = [&#39;title&#39;];<br><br>function Main() {<br>  const [movies, setMovies] = useState({});<br>  const [movieType, setMovieType] = useState(&#39;&#39;);<br><br>  useEffect(() =&gt; {<br>    try {<br>      (async () =&gt; {<br>        const popularMovies = await Get.movies(&#39;now_playing&#39;);<br>        setMovies(state =&gt; {<br>          const newState = { ...state };<br>          newState.now_playing = popularMovies.data.results;<br>          return newState;<br>        });<br>        setMovieType(&#39;now_playing&#39;);<br>      })();<br>    } catch (e) {<br>      console.log({ e });<br>    }<br>  }, []);<br><br>  return (<br>    &lt;RootContainer&gt;<br>      &lt;ContentSection&gt;<br>        &lt;MoviesGridSection&gt;<br>          &lt;MoviesGrid items={results} /&gt;<br>        &lt;/MoviesGridSection&gt;<br>      &lt;/ContentSection&gt;<br>    &lt;/RootContainer&gt;<br>  );<br>}<br><br>export default Main;</pre><ul><li>In the index.js file we are using useState and useEffect. Let&#39;s see what they do.</li><li>First useState. We are all familiar with defining a state object in the constructor of a class component. Synonymous to that in a functional component we can define stateful variables using the useState hook.</li><li>useState is nothing but a JavaScript function that takes in an initial value as an argument and returns us an array. eg. const [A, setA] = useState(0). Here we are passing the useState hook an initial value of 0 and it returns to us an array with two entries. The first is the current value of that variable and the second one is a function to set that value.</li><li>As a comparison, the state variable in the above code in a class component would look like this</li></ul><pre>this.state = {<br>  movies: {},<br>  movieType: &#39;&#39;<br>};</pre><ul><li>We know that whenever we do this.setState() in a class component it is rerendered. Similarly when we call the set function that was returned by useState the component is rerendered. eg. calling setA() in the above point would rerender the component.</li><li>And this is useState in a nutshell. At the end of the day, it allows you to declare state variables.</li><li>Moving on to useEffect. useEffect allows us to do the tasks that we used to do in the life-cycle methods.</li><li>useEffect is much more involved than useState. It takes in as arguments a callback function and an optional dependency array. It looks like this useEffect(callback, &lt;dependencies&gt;).</li><li>The callback function specifies what the effect should do while the dependencies array tells when the effect needs to be run.</li><li>If useEffect does not have a dependency array it will run on every render, if it is an empty array it will run only on the first render and if the dependency array has contents, it will run whenever those dependencies change.</li><li>Specifying an empty array can be used to do tasks that we usually do in the componentDidMount() life-cycle method. Since we want to fetch the data only once we have used an empty array in the useEffect hook in the code.</li></ul><p>Go ahead and run the app using npm start and you&#39;ll be able to see a list of movies.</p><p>Next, we want to add a search to our app.</p><ul><li>In this app, we will be using <a href="https://fusejs.io/">Fuse.js</a> to perform a fuzzy search in our app.</li><li>Go ahead and install the fuse.js module using npm install fuse.js.</li></ul><p>First, let’s add a Search component to the app. Create a directory called Search and add in the index.js and styled.js files.</p><h3>Search component</h3><h4>Search/index.js</h4><pre>import React from &#39;react&#39;;<br>import { MdSearch } from &#39;react-icons/md&#39;;<br>import PropTypes from &#39;prop-types&#39;;<br><br>import { SearchBarContainer, SearchIcon, SearchInput } from &#39;./styled&#39;;<br><br>function Search({ handler, value }) {<br>  return (<br>    &lt;SearchBarContainer&gt;<br>      &lt;SearchIcon&gt;<br>        &lt;MdSearch /&gt;<br>      &lt;/SearchIcon&gt;<br>      &lt;SearchInput<br>        onChange={handler}<br>        value={value}<br>        placeholder=&#39;Search Movies&#39;<br>      /&gt;<br>    &lt;/SearchBarContainer&gt;<br>  );<br>}<br><br>Search.propTypes = {<br>  handler: PropTypes.func,<br>  value: PropTypes.string<br>};<br><br>Search.defaultProps = {<br>  handler: () =&gt; {},<br>  value: &#39;&#39;<br>};<br><br>export default Search;</pre><h4>Search/styled.js</h4><pre>import styled from &#39;styled-components&#39;;<br><br>const SearchBarContainer = styled.div`<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  height: 100%;<br>  width: 100%;<br>  border-bottom: 2px solid #dfe5ef;<br>`;<br><br>const SearchIcon = styled.div`<br>  display: inline-flex;<br>  height: 24px;<br>  width: 24px;<br>  color: #9d9fb0;<br>  font-size: 14px;<br>  font-weight: bolder;<br>  svg {<br>    height: 100%;<br>    width: 100%;<br>  }<br>`;<br><br>const SearchInput = styled.input`<br>  height: 24px;<br>  width: 100%;<br>  margin-left: 10px;<br>  border: none;<br>  background-color: transparent;<br>  color: #9d9fb0;<br>  font-size: 14px;<br>  font-weight: bolder;<br>`;<br><br>export { SearchBarContainer, SearchIcon, SearchInput };</pre><ul><li>We are going to add this component to our Main view. Replace the contents of the return with the code below.</li></ul><pre>return (<br>    &lt;RootContainer&gt;<br>      &lt;ContentSection&gt;<br>        &lt;SearchBarSection&gt;<br>          &lt;Search handler={e =&gt; search(e.target.value)} value={searchTerm} /&gt;<br>        &lt;/SearchBarSection&gt;<br>        &lt;MoviesGridSection&gt;<br>          &lt;MoviesGrid items={results} /&gt;<br>        &lt;/MoviesGridSection&gt;<br>      &lt;/ContentSection&gt;<br>    &lt;/RootContainer&gt;<br>  );</pre><ul><li>Now we will be writing a custom hook that can perform the search for us.</li><li>Create a new file called useSearch.js and add the code given below.</li></ul><pre>import { useState } from &#39;react&#39;;<br>import Fuse from &#39;fuse.js&#39;;<br><br>function search({ fuse, data, term }) {<br>  const results = fuse.search(term);<br>  return term ? results : data;<br>}<br><br>function useSearch({ data = [], options }) {<br>  const [searchTerm, setSearchTerm] = useState(&#39;&#39;);<br>  const fuse = new Fuse(data, options);<br>  const results = search({ fuse, data, term: searchTerm });<br>  const reset = () =&gt; setSearchTerm(&#39;&#39;);<br>  return { results, search: setSearchTerm, searchTerm, reset };<br>}<br><br>export default useSearch;</pre><ul><li>As you can see we are using the useState React hook to create a custom hook. This hook takes in the array that we want to search through and options to pass into fuse.js. For our app, we will be searching the movies list based on their names.</li><li>Let’s use this hook in our Main view.</li><li>Copy the code below and paste it below useEffect in the Main view render function.</li></ul><pre>const { results, search, searchTerm } = useSearch({<br>  data: movies[movieType],<br>  options: Constants.FuseOptions<br>});</pre><ul><li>And there it is, we just added search to our app. You’ll be able to search through the movies based on their titles.</li></ul><p>As you can see React hooks make things so much cleaner and easier to understand. I love hooks and hope after this article you look hooks too.</p><p>As always feel free to drop a comment if you are stuck somewhere or would like to discuss something or give me some feedback.</p><p>Check out the <a href="https://manan30.github.io/movies-db/">demo</a> and complete <a href="https://github.com/manan30/movies-db">code</a>.</p><p>Find me on <a href="https://twitter.com/Manan_30">Twitter</a> and <a href="https://www.instagram.com/manan__joshi/">Instagram</a></p><p><em>Originally published at </em><a href="https://dev.to/manan30/creating-a-searchable-movie-app-using-react-styled-components-and-react-hooks-25ej"><em>https://dev.to</em></a><em> on November 14, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d149611d05c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/creating-a-searchable-movie-app-using-react-styled-components-and-react-hooks-8d149611d05c">Creating a searchable movie app using React, styled-components and React Hooks</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a rudimentary pool table game using React, Three JS and react-three-fiber]]></title>
            <link>https://javascript.plainenglish.io/creating-a-rudimentary-pool-table-game-using-react-three-js-and-react-three-fiber-part-1-cbb1214bed82?source=rss-d0bdd5ea420a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbb1214bed82</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Manan Joshi]]></dc:creator>
            <pubDate>Mon, 28 Oct 2019 20:43:28 GMT</pubDate>
            <atom:updated>2019-12-09T21:10:28.710Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a pool table game using React, Three JS and react-three-fiber</h3><h4>Part 1</h4><p>For a long time, I wanted to learn and get started with WebGL. Having done some work with OpenGL I thought WebGL would be a great addition to know and learn. This is when I came across three.js.</p><p><a href="https://threejs.org/"><strong>Three.js</strong></a> is an awesome 3D library for working with graphics on the web. It is written in JavaScript but does not have native support for React. Having worked with React a lot I wanted to use the expressiveness of React combined with the power of three js. This is when I found <a href="https://github.com/react-spring/react-three-fiber"><strong>react-three-fiber</strong></a>. It is a lightweight React renderer for three.js and works well.</p><p>This is a three-part series of articles where we will see how we can use React, three.js, and react-three-fiber to create a game of pool table.</p><ul><li>Part 1: Getting started with React, three.js, and react-three-fiber.</li><li>Part 2: Setting up the basic scene (Coming soon).</li><li>Part 3: Adding physics and finishing up(Coming soon).</li></ul><h3>First things first</h3><ul><li>Create a React project. The best way to do this is by using <a href="https://github.com/facebook/create-react-app"><strong>create-react-app</strong></a></li><li>The next step is to install the three.js and react-three-fiber modules. Depending on the package manager of your choice go ahead and install them. npm i three react-three-fiber or yarn add three react-three-fiber</li></ul><p>Now that our project is set up let’s do the fun part and jump into coding.</p><h3>Organizing the project</h3><p>This is a project structure that I like to follow and by no means, you’ve to do this. This is how I like to organize but feel free to move things around.</p><p>Inside the src directory let’s create different directories for components, views, utils, and assets. Your directory structure should look something like this</p><pre>project<br>+-- README.md<br>+-- src<br>|   +-- index.js<br>|   +-- App.js<br>|   +-- assets/<br>|   +-- components/<br>|   +-- utils/<br>|   +-- views/</pre><h3>Creating a basic scene</h3><ul><li>Go ahead and create a file called Scene.js inside the views directory.</li><li>Just copy and paste the code below in the Scene.js file.</li></ul><p>This will create a cube mesh for us.</p><p>Let’s go and see what each line does.</p><p>All the jsx tags that you see are react-three-fiber wrappers around three.js objects</p><ul><li>The mesh component is the <a href="https://threejs.org/docs/#api/en/objects/Mesh">Mesh</a> object from the three js library. The same is true for <a href="https://threejs.org/docs/#api/en/geometries/BoxBufferGeometry">boxBufferGeometry</a> and <a href="https://threejs.org/docs/#api/en/materials/MeshNormalMaterial">meshNormalMaterial</a>.</li><li>If you check out the docs for the components on the three js website you’ll see BoxBufferGeometry has a constructor with a bunch of parameters.</li><li>The way you can create a new instance in React with react-three-fiber is by using the <strong>args</strong> prop for that component and passing in the parameters as an array.</li><li>So in the above example, &lt;boxBufferGeometry attach=&#39;geometry&#39; args={[1, 1, 1]} /&gt; will create a new BoxBufferGeometry (aka cube) with params 1, 1, and 1 for width, height, and depth respectively. The <strong>attach</strong> prop tells the renderer what kind of object the given component is. You can use all the properties for this given object and from its superclass as props to the component. You can find all the properties in the <a href="https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene">docs</a> for three js.</li><li>Similarly, the meshNormalMaterial can be used to color the geometry among many other uses which we will see later.</li></ul><p>Congratulations you just created a cube and added it to the scene. The next step is to render the scene inside of a canvas element. You all know how to do this, so bye-bye and happy coding.</p><p>I was just kidding. So now, let’s create a canvas.</p><h3>Creating the Canvas</h3><p>We are done at this point. Just go and run npm start and you&#39;ll be able to see your beautiful cube in the browser.</p><p>Your output should look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*4rm5EWQsbeuT1_1L" /><figcaption>Basic cube</figcaption></figure><ul><li>Just one last thing to do here is the canvas doesn’t take the entire height of the screen.</li><li>So in your index.css just add the following lines</li></ul><p>I hope you’re happy with the effort you just put in but as you can see the cube looks more like a square. Don’t panic, believe me, it is a cube. To see it as a 3D object let’s add mouse/track-pad controls so that we can perform pan, rotate and zoom(aka orbit controls).</p><h3>Adding Orbit Controls</h3><ul><li>The first thing to understand here is, OrbitControls is not part of the main three modules, hence you cannot use it directly as we saw in the previous mesh and geometry code for the cube.</li><li>To deal with this react-three-fiber provides an extend function which can be used for modules outside of the main three js codebase. Remember to call the extend function in the beginning before the component function and after that, you&#39;ll be able to use the extended module like any other three js module.</li><li>So, now as we saw earlier while using mesh and geometry we can use orbit controls in the same way along with all its <a href="https://threejs.org/docs/#examples/en/controls/OrbitControls">properties</a>.</li><li>Let’s talk about the hooks used above as well useRef, useThree and useFrame.</li><li>useRef among other things is Reacts’ way of giving us access to the underlying dom node. You can read more about it <a href="https://reactjs.org/docs/hooks-reference.html#useref">here</a></li><li><a href="https://github.com/react-spring/react-three-fiber#hooks">useThree</a> is a react-three-fiber hook that essentially gives us access to everything that is added to the scene. This is going to be super helpful to us later on.</li><li><a href="https://github.com/react-spring/react-three-fiber#hooks">useFrame</a> also a react-three-fiber hook is called for every frame that is drawn. If you have used RequestAnimationFrame API provided by the browser, this hook is similar to that. It will be formulating the basics of our physics calculation later on in the example.</li><li>And the final step is adding the newly created controls to the canvas. To do this open the App.js file and replace the current code with the code below.</li></ul><p>Start the app and nothing will have changed but now you’ll be able to use your mouse-wheel/track-pad to zoom in and out while holding on to the left click will allow you to rotate and inspect the cube from all sides as well as allow you to pan. You should be able to do something like this shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*V1adUE57tbDUBUiz" /><figcaption>Cube after adding orbit controls</figcaption></figure><p>Before we jump into modeling out our pool table there is just one last thing that we want to do. Let us just adjust our camera a little bit so that we can see how to change the default settings on the camera.</p><h3>Editing the camera settings</h3><ul><li>You will be able to find all the properties and functions the camera object has <a href="https://threejs.org/docs/#api/en/cameras/PerspectiveCamera">here</a>.</li></ul><p>This concludes part 1 of the three-part series. I’ll be posting the upcoming parts in the following days.</p><p>Also, this is my first blog post ever. It will be great if you could leave some feedback in the comments so that I can understand and improve my content delivery. You can follow me on <a href="https://twitter.com/Manan_30">Twitter</a> and <a href="https://www.instagram.com/manan__joshi/">Instagram</a>.</p><p>Peace out and happy coding!!!</p><p><em>Originally published at </em><a href="https://dev.to/manan30/creating-a-rudimentary-pool-table-game-using-react-three-js-and-react-three-fiber-part-1-363l"><em>https://dev.to</em></a><em> on October 28, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbb1214bed82" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/creating-a-rudimentary-pool-table-game-using-react-three-js-and-react-three-fiber-part-1-cbb1214bed82">Creating a rudimentary pool table game using React, Three JS and react-three-fiber</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>