<?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: Kyle A.</title>
    <description>The latest articles on DEV Community by Kyle A. (@kylestech95).</description>
    <link>https://dev.to/kylestech95</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%2F1262163%2Fabc268bd-66a9-42c6-aa35-ff73c09671ab.jpeg</url>
      <title>DEV Community: Kyle A.</title>
      <link>https://dev.to/kylestech95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kylestech95"/>
    <language>en</language>
    <item>
      <title>ReactJS - Character Selection</title>
      <dc:creator>Kyle A.</dc:creator>
      <pubDate>Fri, 01 Mar 2024 23:13:50 +0000</pubDate>
      <link>https://dev.to/kylestech95/reactjs-character-selection-hl0</link>
      <guid>https://dev.to/kylestech95/reactjs-character-selection-hl0</guid>
      <description>&lt;p&gt;Test out: &lt;a href="https://kylestech95.github.io/tile-selection-tool-interactive"&gt;https://kylestech95.github.io/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Source Code: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Clone Ref: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive.git"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a gamer it is essential to navigate through options &amp;amp; characters. You can do exactly that with this traditional selection-feature created with ReactJS, CSS, &amp;amp; HTML.&lt;/p&gt;

&lt;p&gt;Users can navigate through characters with their mouse or keypad:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Controls&lt;/strong&gt;:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Mouse move/hover&lt;/li&gt;
&lt;li&gt;&amp;gt; Right Arrow&lt;/li&gt;
&lt;li&gt;&amp;lt; Left Arrow&lt;/li&gt;
&lt;li&gt;v Down Arrow&lt;/li&gt;
&lt;li&gt;^ Up Arrow&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Instructions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fodqobh7dujx9n9ji391t.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fodqobh7dujx9n9ji391t.gif" alt="Instructions" width="470" height="940"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Languages:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;ReactJS&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Learning Objectives from project-code
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Understanding of project setup&lt;/li&gt;
&lt;li&gt;Mapping data with &lt;em&gt;&lt;strong&gt;key&lt;/strong&gt; index&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Understanding a few basic &lt;a href="https://legacy.reactjs.org/docs/hooks-intro.html"&gt;&lt;u&gt;ReactJS-Hooks&lt;/u&gt;&lt;/a&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a. useState()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;d. useRef()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Project Setup
&lt;/h2&gt;

&lt;p&gt;While there are a number of ways to setup a tile-selection program,&lt;br&gt;
this project utilizes an &lt;strong&gt;&lt;em&gt;array of objects&lt;/em&gt;&lt;/strong&gt;, stored into a state called &lt;em&gt;&lt;strong&gt;player&lt;/strong&gt;&lt;/em&gt;, and then rendered into 6 list-items &lt;code&gt;&amp;lt;li className="list-item"&amp;gt;&amp;lt;/li&amp;gt;&lt;/code&gt; in the &lt;em&gt;&lt;strong&gt;domain(DOM)&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj69rgiqwyw7sat5y5t8z.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj69rgiqwyw7sat5y5t8z.gif" alt="character selection" width="600" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tile Tracking&lt;/strong&gt;&lt;br&gt;
Within &lt;em&gt;App.js&lt;/em&gt;, take a look at the &lt;strong&gt;&lt;em&gt;player&lt;/em&gt;&lt;/strong&gt; Array.&lt;br&gt;
Each object listed contains a &lt;code&gt;src:&lt;/code&gt; property with an array of 2 numbers representing &lt;strong&gt;x&lt;/strong&gt; &amp;amp; &lt;strong&gt;y&lt;/strong&gt;, respectively.&lt;br&gt;
After iterating through the array, each player &lt;code&gt;src:&lt;/code&gt; is parsed into objects and used for tracking tiles in the DOM.&lt;/p&gt;

&lt;p&gt;Within &lt;em&gt;choice.js&lt;/em&gt;, un-comment the code below and press any &lt;em&gt;&lt;strong&gt;arrow key&lt;/strong&gt;&lt;/em&gt; to view the output:&lt;br&gt;
&lt;code&gt;// fn converts array to object with 2 arguments (element,index)&lt;br&gt;
  const arrayToObject = (p,index) =&amp;gt;{&lt;br&gt;
    return {x:p[index].pos[0],y:p[index].pos[1]}&lt;br&gt;
   }&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;code&gt;const items = document.querySelectorAll('.list-item')&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;code&gt;for(let i = 0; i &amp;lt; items.length; i++){&lt;br&gt;
        // convery array to an object&lt;br&gt;
        let obj = arrayToObject(player,i)&lt;br&gt;
        // console.log(obj)&lt;br&gt;
        // console.log(items[i])&lt;br&gt;
        // console.log("\n")&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhiogjszuwab3uogvh4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhiogjszuwab3uogvh4q.png" alt="position coords" width="504" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ReactJS Key
&lt;/h2&gt;

&lt;p&gt;Stay on &lt;em&gt;choice.js&lt;/em&gt; and navigate to &lt;code&gt;// return render&lt;/code&gt;. Here, &lt;br&gt;
 &lt;strong&gt;&lt;em&gt;player&lt;/em&gt;&lt;/strong&gt;, or the &lt;strong&gt;&lt;em&gt;array of objects&lt;/em&gt;&lt;/strong&gt;, is being mapped to list all lite-items &lt;code&gt;&amp;lt;li&amp;gt;&amp;lt;li/&amp;gt;&lt;/code&gt; by its key property &lt;code&gt;key={p.key}&lt;/code&gt;.&lt;br&gt;
Typically a key is required if multiple objects/arrays within a list are being rendered.&lt;br&gt;
The main purpose of keys is to determine which elements have been modified (modify,delete).&lt;br&gt;
View the code below for a better understanding.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{[...player].map((p,index)=&amp;gt;{&lt;br&gt;
              return (&lt;br&gt;
                &amp;lt;div key={p.key} className="button-back"&amp;gt;&lt;br&gt;
                  &amp;lt;li key={p.key} className={&lt;/code&gt;list-item p${index+1}&lt;code&gt;}&amp;gt;&amp;lt;img className="img" src={p.src} alt={p.alt} /&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
                &amp;lt;/div&amp;gt;&lt;br&gt;
              )&lt;br&gt;
            })}&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Test out: &lt;a href="https://kylestech95.github.io/tile-selection-tool-interactive"&gt;https://kylestech95.github.io/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Source Code: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Clone Ref: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive.git"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive.git&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  hooks
&lt;/h2&gt;

&lt;p&gt;Think of react hooks as an individual who is &lt;strong&gt;&lt;em&gt;asthmatic&lt;/em&gt;&lt;/strong&gt; &amp;amp; holds onto an &lt;strong&gt;&lt;em&gt;inhaler&lt;/em&gt;&lt;/strong&gt; to sustain life, or the &lt;u&gt;&lt;em&gt;life-cycle&lt;/em&gt;&lt;/u&gt;.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;You, the developer have asthma and need to ensure your quality of life is functional.&lt;/u&gt;&lt;br&gt;
&lt;strong&gt;Do I only have to use my inhaler&lt;/strong&gt;? ... &lt;strong&gt;NO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In addition, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Exercise&lt;/em&gt;&lt;/strong&gt; to increase your stamina&lt;/li&gt;
&lt;li&gt;Sustain a &lt;strong&gt;&lt;em&gt;healthy diet&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sip on Tea&lt;/strong&gt; Fennel Tea, Licorice Tea, Ginger Tea, etc...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically, whatever you need to do to maintain asthma may come in the form of the above bulletins.&lt;br&gt;
Similarly, ReactJS uses &lt;em&gt;hooks&lt;/em&gt; such as &lt;strong&gt;useState() and useRef&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;useState Example&lt;/strong&gt;&lt;br&gt;
Within &lt;code&gt;App.js&lt;/code&gt;, we declare a useState() with a string and store it in a variable called &lt;strong&gt;header&lt;/strong&gt;.&lt;br&gt;
&lt;u&gt;Now we can use this &lt;strong&gt;state&lt;/strong&gt;, or &lt;em&gt;"life-sustainer"&lt;/em&gt; inside of a functional component&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhyap0dtq7anfyp3it4d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhyap0dtq7anfyp3it4d.png" alt="usestate1" width="665" height="34"&gt;&lt;/a&gt; &lt;br&gt;
Within the same file &lt;code&gt;App.js&lt;/code&gt; scroll down to the bottom of the file.&lt;br&gt;
Within the &lt;code&gt;&amp;lt;Header/&amp;gt;&lt;/code&gt; component, plug in the &lt;strong&gt;header&lt;/strong&gt; variable as a prop.&lt;br&gt;
&lt;u&gt;Just like the &lt;em&gt;&lt;strong&gt;header&lt;/strong&gt;&lt;/em&gt; prop, I &lt;em&gt;&lt;strong&gt;carry&lt;/strong&gt;&lt;/em&gt;  my &lt;em&gt;&lt;strong&gt;inhaler&lt;/strong&gt;&lt;/em&gt; wherever I go to prevent asthma attacks or shortness of breath. I need to make living work!&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsfphov8s1wz4jyllu5jn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsfphov8s1wz4jyllu5jn.png" alt="usestate3" width="362" height="42"&gt;&lt;/a&gt;&lt;br&gt;
Within the same file, scroll to the top to access the &lt;code&gt;Header&lt;/code&gt; &lt;br&gt;
 Component.&lt;br&gt;
Plug your prop [header] into the function's arguments and pass it as text in the &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element.&lt;br&gt;
&lt;u&gt;At this point, we completed a quarter-mile jog.&lt;br&gt;
But wait, in &lt;em&gt;our current state&lt;/em&gt; we need to take our &lt;em&gt;medicine&lt;/em&gt;[inhaler]! The &lt;em&gt;welcome&lt;/em&gt; header is displayed.&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm28bfqiy7b8ztlosrd8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm28bfqiy7b8ztlosrd8i.png" alt="usestate2" width="693" height="220"&gt;&lt;/a&gt;&lt;br&gt;
Within the same file &lt;code&gt;App.js&lt;/code&gt; scroll down to the bottom of the file.&lt;br&gt;
Within the &lt;code&gt;&amp;lt;Choice/&amp;gt;&lt;/code&gt; component, plug in both &lt;strong&gt;header&lt;/strong&gt; &amp;amp; &lt;strong&gt;setHeader&lt;/strong&gt; variables as a prop.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9v3f4qj188qchegayq8z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9v3f4qj188qchegayq8z.png" alt="usestate3" width="800" height="37"&gt;&lt;/a&gt;&lt;br&gt;
Access &lt;code&gt;choice.js&lt;/code&gt;, navigate the &lt;strong&gt;Choice&lt;/strong&gt; component. Plug-in both props [header &amp;amp; setHeader] into the function's arguments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj28a1or0j0keimps8ktz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj28a1or0j0keimps8ktz.png" alt="choiceusestate" width="800" height="54"&gt;&lt;/a&gt;&lt;br&gt;
Finally we set the header's state to the tile's animal-name by accessing it's &lt;strong&gt;&lt;em&gt;alt&lt;/em&gt;&lt;/strong&gt; property when we land on a tile.&lt;br&gt;
&lt;u&gt;Just like both &lt;em&gt;&lt;strong&gt;header &amp;amp; setHeader&lt;/strong&gt;&lt;/em&gt; props, after I &lt;em&gt;&lt;strong&gt;use my inhaler&lt;/strong&gt;&lt;/em&gt;[header] my breathing, or &lt;strong&gt;&lt;em&gt;state&lt;/em&gt;&lt;/strong&gt; changes. We then set the header to a different state with &lt;code&gt;setHeader()&lt;/code&gt;. After arriving home, I drank &lt;em&gt;&lt;strong&gt;ginger tea&lt;/strong&gt;&lt;/em&gt;  which changed my state again.&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdxumldryf46sb036m4mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdxumldryf46sb036m4mx.png" alt="usestate5" width="780" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more information on &lt;code&gt;useState()&lt;/code&gt; learn more with &lt;a href="https://www.w3schools.com/react/react_usestate.asp"&gt;www3Schools&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Test out: &lt;a href="https://kylestech95.github.io/tile-selection-tool-interactive"&gt;https://kylestech95.github.io/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Source Code: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Clone Ref: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive.git"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;useRef Example&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;useRef()&lt;/code&gt; hook allows developers to reference elements that do not need to be rendered.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Imagine &lt;em&gt;&lt;strong&gt;hiring&lt;/strong&gt;&lt;/em&gt; a &lt;strong&gt;&lt;em&gt;jewel-thief&lt;/em&gt;&lt;/strong&gt; to access a secure diamond room by roping down from the roof. Despite evading all of security controls (trip-wires, lasers, cameras,automatic firearms,etc...), the thief keeps their cool. They tactfully grab the diamond and helicopter out from the roof!&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;The thief is your &lt;code&gt;useRef()&lt;/code&gt; called &lt;code&gt;thiefRef&lt;/code&gt;&lt;/u&gt;.&lt;br&gt;
&lt;em&gt;&lt;u&gt;We hire the thief to change the &lt;strong&gt;state&lt;/strong&gt; of the jewelry’s position.&lt;/u&gt;&lt;br&gt;
&lt;u&gt;The state changes after the thief steals the &lt;strong&gt;diamond&lt;/strong&gt; without crashing the application. We summoned our _&lt;strong&gt;ref&lt;/strong&gt;&lt;/u&gt;&lt;/em&gt;, the application's state changes and no one gets hurt or in trouble...unless you were the jeweler..&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Since you &lt;strong&gt;&lt;em&gt;hired&lt;/em&gt;&lt;/strong&gt; the &lt;strong&gt;&lt;em&gt;thief&lt;/em&gt;&lt;/strong&gt;, and the job was successful, the thief is willing to rob more diamonds for you, in other words the theif,&lt;code&gt;thiefRef&lt;/code&gt; can be &lt;strong&gt;reused&lt;/strong&gt; without being rendered.&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;useRef in code&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Scenario&lt;/strong&gt;: &lt;em&gt;I want&lt;/em&gt; to access the object &lt;strong&gt;{}&lt;/strong&gt; at the top of the screen with the &lt;code&gt;useRef()&lt;/code&gt; hook&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mncqqh7alag840keenw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mncqqh7alag840keenw.png" alt="object brack" width="589" height="168"&gt;&lt;/a&gt;&lt;br&gt;
Within &lt;code&gt;App.js&lt;/code&gt; declare a &lt;strong&gt;useRef()&lt;/strong&gt; and store it in a variable called &lt;strong&gt;posRef&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4n7sux5fk9l171imk7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4n7sux5fk9l171imk7f.png" alt="p1" width="422" height="56"&gt;&lt;/a&gt;&lt;br&gt;
Just like states, &lt;strong&gt;carry&lt;/strong&gt; the &lt;strong&gt;posRef&lt;/strong&gt; down to a component, in this case, we &lt;strong&gt;carry&lt;/strong&gt; &lt;strong&gt;posRef&lt;/strong&gt; down to the &lt;code&gt;&amp;lt;Object/&amp;gt;&lt;/code&gt; component.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F273z7zu47bn1kz3ddpb8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F273z7zu47bn1kz3ddpb8.png" alt="p2" width="542" height="47"&gt;&lt;/a&gt;&lt;br&gt;
Within the same file, scroll to the top of the page, locate the &lt;strong&gt;Object&lt;/strong&gt; function, and plug-in posRef into the argument.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fosu02oul1q5r5yy1fhpe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fosu02oul1q5r5yy1fhpe.png" alt="p3" width="588" height="71"&gt;&lt;/a&gt;&lt;br&gt;
Next, we plant our &lt;strong&gt;posRef&lt;/strong&gt; into an html attribute called "&lt;em&gt;ref&lt;/em&gt;".&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4ljvzpjzfmu1niuuq5c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4ljvzpjzfmu1niuuq5c.png" alt="p4" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we access &lt;strong&gt;posRef&lt;/strong&gt; with &lt;code&gt;posRef.current&lt;/code&gt; which gives us access to the element where the &lt;code&gt;id="object-container"&lt;/code&gt;.&lt;br&gt;
In the below code, we are removing the value's class, &lt;em&gt;obj-remove&lt;/em&gt; with &lt;strong&gt;posRef.current&lt;/strong&gt;. How cool is that!&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8b7mqagf7texzwkg5vp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8b7mqagf7texzwkg5vp.png" alt="removeobj" width="731" height="129"&gt;&lt;/a&gt;&lt;br&gt;
For more information on &lt;code&gt;useRef()&lt;/code&gt; learn more with &lt;a href="https://www.w3schools.com/react/react_useref.asp"&gt;www3Schools&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, &lt;br&gt;
working with the ReactJS Framework takes time and patience in order to understand how state works as well as the hooks that come with ReactJS.&lt;br&gt;
May this blog post help broaden your understanding of the ReactJS Framework.&lt;/p&gt;

&lt;p&gt;Test out: &lt;a href="https://kylestech95.github.io/tile-selection-tool-interactive"&gt;https://kylestech95.github.io/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Source Code: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive&lt;/a&gt;&lt;br&gt;
Clone Ref: &lt;a href="https://github.com/KylesTech95/tile-selection-tool-interactive.git"&gt;https://github.com/KylesTech95/tile-selection-tool-interactive.git&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
      <category>mit</category>
    </item>
    <item>
      <title>Mongoose/Mongodb - CRUD(Create, Retrieve, Update, and Delete) Playground</title>
      <dc:creator>Kyle A.</dc:creator>
      <pubDate>Thu, 22 Feb 2024 02:35:37 +0000</pubDate>
      <link>https://dev.to/kylestech95/mongoosemongodb-crudcreate-retrieve-update-and-delete-playground-4dp</link>
      <guid>https://dev.to/kylestech95/mongoosemongodb-crudcreate-retrieve-update-and-delete-playground-4dp</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;A simple &amp;amp; interactive guide to understanding CRUD Storage/Database operations created with NodeJS, Mongoose and Mongodb.&lt;/p&gt;

&lt;h2&gt;
  
  
  Languages:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;SQL&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Before accessing mongoDB datasets, install the required packages:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install mongoose&lt;/code&gt;&lt;br&gt;
&lt;code&gt;const mongoose = require('mongoose')&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To use an environment Variable(.env), install the required packages:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install --save dotenv&lt;/code&gt;&lt;br&gt;
&lt;code&gt;require('dotenv').config();&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To Build Applications &amp;amp; APIs, install the required packages:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install express&lt;/code&gt;&lt;br&gt;
&lt;code&gt;const express = require('express');&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Feel free to install nodemon, which monitors your activity and restarts scripts automatically upon reading changes in code. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install --save-dev nodemon&lt;/code&gt;&lt;br&gt;
h&lt;br&gt;
&lt;strong&gt;Terminal&lt;/strong&gt;:&lt;br&gt;
Instead of Running:&lt;br&gt;
&lt;code&gt;npm run start&lt;/code&gt;&lt;br&gt;
run:&lt;br&gt;
&lt;code&gt;nodemon myApp.js&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Create
&lt;/h2&gt;

&lt;p&gt;First, creating a dataset requires input (user-input or auto-generated) as well as developed &lt;em&gt;Schema&lt;/em&gt; for the data to &lt;em&gt;fit&lt;/em&gt; into.&lt;/p&gt;




&lt;p&gt;This process can be synonymous to &lt;em&gt;students attending a new classroom for the first time &amp;amp; being assigned to a seat by the teacher.&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;You are the teacher and the data are your students.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Creating a schema can be developed in different ways and is going to be dependent on the application as far as data-types, amount of data entered, and the associations chosen between data.&lt;/p&gt;

&lt;p&gt;For more information on starting your own mongoose schema, check the docs:&lt;a href="https://mongoosejs.com/docs/guide.html"&gt;Mongoose Schemas&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;User1&lt;/strong&gt; is created after entering:&lt;/em&gt;&lt;br&gt;
1.Name&lt;br&gt;
2.Email&lt;br&gt;
3.Todo&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;em&gt;**View the Code snippet for example codes&lt;/em&gt;*&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1pa57m8zprt8sw3pmbsn.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1pa57m8zprt8sw3pmbsn.gif" alt="New User" width="600" height="380"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Anonymous0&lt;/strong&gt; user is created after entering:&lt;/em&gt;&lt;br&gt;
1.____&lt;br&gt;
2.Email&lt;br&gt;
3.Todo&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Feat:&lt;/strong&gt; Anonymous usernames increment automatically by filtering through the existing array of names that match &lt;strong&gt;/Anonymous/&lt;/strong&gt; &amp;amp; obtaining the array's length&lt;/em&gt;.&lt;br&gt;
Store the modified array in a variable called &lt;em&gt;count&lt;/em&gt;&lt;br&gt;
Upon creating a new user, if a name is not stored, then &lt;strong&gt;&lt;em&gt;"Anonymous" + count&lt;/em&gt;&lt;/strong&gt; will take undefined's place.&lt;br&gt;
&lt;code&gt;const newUser = new User({ &lt;br&gt;
                // create new user &amp;amp; email&lt;br&gt;
                name:name?name:'Anonymous'+count,&lt;br&gt;
                email&lt;br&gt;
            })&lt;br&gt;
            const sU = await newUser.save() //save user&lt;br&gt;
            console.log(sU)&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&lt;em&gt;**View the Code snippet for example codes&lt;/em&gt;*&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiooci7adlsdgd4zpflnw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiooci7adlsdgd4zpflnw.gif" alt="new Anonymous User" width="600" height="424"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;testUser&lt;/strong&gt; is created after entering:&lt;/em&gt;&lt;br&gt;
1.Name&lt;br&gt;
2.Email&lt;br&gt;
3._____&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Feat:&lt;/strong&gt; Users who do not store a todo will automatically be replaced with "n/a"&lt;/em&gt; . &lt;br&gt;
&lt;code&gt;const todoObj = new Todo({&lt;br&gt;
                email: sU.email,&lt;br&gt;
                todo:todo ? todo : 'N/A'.toLowerCase()&lt;br&gt;
            })&lt;br&gt;
            const sTodo = await todoObj.save();&lt;br&gt;
            console.log(sTodo)&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&lt;em&gt;**View the Code snippet for example codes&lt;/em&gt;*&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn68a23vycle56ps1yug6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn68a23vycle56ps1yug6.gif" alt="Create User with No Todo Input" width="600" height="424"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;No User&lt;/strong&gt; is created after reaching the max capacity (10)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// if user is not found in db, create new user&lt;br&gt;
        if(!findUser){&lt;br&gt;
            if(allUsers.length &amp;gt; 9){&lt;br&gt;
                res.sendFile(__dirname + '/views/max.html')&lt;br&gt;
            }&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&lt;em&gt;**View the Code snippet for example codes&lt;/em&gt;*&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ots3e5irchbbpffkyou.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ots3e5irchbbpffkyou.gif" alt="Max Users limitation" width="600" height="380"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Retrieve
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Retrieve&lt;/strong&gt; or &lt;strong&gt;Read&lt;/strong&gt; operations in &lt;strong&gt;C.R.U.D&lt;/strong&gt; involves searching data &amp;amp; receiving data. &lt;br&gt;
-Upon visiting one of the three &lt;strong&gt;filtered&lt;/strong&gt; search endpoints, users can filter through data based on that type (users,todos,email).&lt;br&gt;
-Else, users can scroll through the table to view all data.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagepinl039lh42qi2ocd.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagepinl039lh42qi2ocd.gif" alt="Filter search query" width="600" height="396"&gt;&lt;/a&gt;&lt;br&gt;
In the event that the database is empty,&lt;br&gt;
users will not be able to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Drop User&lt;/li&gt;
&lt;li&gt;Drop All Users&lt;/li&gt;
&lt;li&gt;Filter todos&lt;/li&gt;
&lt;li&gt;Filter Users&lt;/li&gt;
&lt;li&gt;Filter email&lt;/li&gt;
&lt;li&gt;Change Email&lt;/li&gt;
&lt;li&gt;Change Name&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Users will be redirected to a web page that states, "No Users Found".&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F866qivlhjunoi05xc0yl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F866qivlhjunoi05xc0yl.gif" alt="No users Found or Read" width="600" height="424"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Remember that classroom analogy above?&lt;br&gt;
Think of reading as &lt;em&gt;roll-call&lt;/em&gt; where the teacher is reading off of a list of user's names to determine who is absent or present.&lt;br&gt;
&lt;strong&gt;You, the teacher, are reading off of a list &amp;amp; filtering the present students from the absent students&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Update
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Updating&lt;/strong&gt; allows the user to change already-existing data.&lt;br&gt;
This process is not &lt;em&gt;Creating&lt;/em&gt; a data record. Existing data is in the process of being updated.&lt;/p&gt;

&lt;p&gt;A POST request is sent to endpoint, "/form/users/email/change". User input is sent to the body object.&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment"&gt;Destructing Assignment&lt;/a&gt; is used to extract values from the body's object (user input).&lt;br&gt;
Take advantage of the &lt;em&gt;id&lt;/em&gt; property and use it as a &lt;em&gt;filter&lt;/em&gt;.&lt;br&gt;
Next, use the &lt;code&gt;model.findById()&lt;/code&gt; function to find the record.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conditions&lt;/strong&gt;:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If current &amp;amp; new email inputs contain an @ and is true&lt;/li&gt;
&lt;li&gt;If a user is found&lt;/li&gt;
&lt;li&gt;If the discovered user's email &lt;code&gt;findOne.email === currentemail&lt;/code&gt; (input)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the above conditions are met, execute the &lt;code&gt;model.findOneAndUpdate()&lt;/code&gt; function&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;User.findOneAndUpdate({email:currentemail},{email:newemail},{new:true})&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update Name with current Name &amp;amp; ID&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0719jlenpxkdfa729dzj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0719jlenpxkdfa729dzj.gif" alt="Update User's Name" width="600" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update Email with current email &amp;amp; ID&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fba7xey9mgh45qsbl0jwk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fba7xey9mgh45qsbl0jwk.gif" alt="Update User's Email" width="600" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update fails&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46l007z47yphussh2iqo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46l007z47yphussh2iqo.gif" alt="Update Permission Denied" width="600" height="303"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Delete
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Deleting&lt;/strong&gt; specific data takes place with the &lt;code&gt;deleteOne()&lt;/code&gt; function.&lt;br&gt;
&lt;code&gt;await User.deleteOne({_id:id})//user found&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fryruhcruvap7s7h9fqba.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fryruhcruvap7s7h9fqba.gif" alt="Drop One User" width="600" height="303"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Deleting Multiple&lt;/strong&gt; data takes place with the &lt;code&gt;deleteMany()&lt;/code&gt; function.&lt;br&gt;
&lt;code&gt;const d =  await User.deleteMany({})&lt;br&gt;
   const e = await Todo.deleteMany({})&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvz9shc1z2mux0i38hdqn.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvz9shc1z2mux0i38hdqn.gif" alt="Drop All Users" width="600" height="424"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Web Link: &lt;a href="https://database-playground.onrender.com/"&gt;Database Playground&lt;/a&gt;&lt;br&gt;
IG: &lt;a href="https://www.instagram.com/index_daddy0/"&gt;Instagram - index_daddy0&lt;/a&gt;&lt;br&gt;
Git: &lt;a href="https://github.com/KylesTech95/database-playground-fork"&gt;Github&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Currently the web service is set for limited use.&lt;br&gt;
If you want access to the playground, send me a DM and I will restart the service for you.&lt;/p&gt;

&lt;p&gt;Alternatively, users can clone the repository&lt;br&gt;
&lt;code&gt;https://github.com/KylesTech95/database-playground-fork.git&lt;/code&gt;&lt;br&gt;
and fork for improved use.&lt;br&gt;
Don't forget to add me.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>ReactJS - Create Magic Eight Ball</title>
      <dc:creator>Kyle A.</dc:creator>
      <pubDate>Thu, 01 Feb 2024 16:33:59 +0000</pubDate>
      <link>https://dev.to/kylestech95/how-to-reactjs-create-magic-eight-ball-4ing</link>
      <guid>https://dev.to/kylestech95/how-to-reactjs-create-magic-eight-ball-4ing</guid>
      <description>&lt;p&gt;Classic Magic 8 Ball accessible for Desktop &amp;amp; Mobile use.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Languages&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;React JS&lt;/li&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Desktop&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F84wut3alyaziv5v0gcl6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F84wut3alyaziv5v0gcl6.png" alt="eightball image" width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/eight-ball-react-js/"&gt;https://kylestech95.github.io/eight-ball-react-js/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/eight-ball-react-js"&gt;https://github.com/KylesTech95/eight-ball-react-js&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/eight-ball-react-js.git"&gt;https://github.com/KylesTech95/eight-ball-react-js.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Portrait&lt;/em&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzi1pz3fhbmqvjc5y8726.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzi1pz3fhbmqvjc5y8726.gif" alt="8 portrait" width="399" height="836"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/eight-ball-react-js/"&gt;https://kylestech95.github.io/eight-ball-react-js/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/eight-ball-react-js"&gt;https://github.com/KylesTech95/eight-ball-react-js&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/eight-ball-react-js.git"&gt;https://github.com/KylesTech95/eight-ball-react-js.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Landscape&lt;/em&gt;)&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetfw2zm1u0uoh308iukl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetfw2zm1u0uoh308iukl.gif" alt="8 landscape" width="600" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/eight-ball-react-js/"&gt;https://kylestech95.github.io/eight-ball-react-js/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/eight-ball-react-js"&gt;https://github.com/KylesTech95/eight-ball-react-js&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/eight-ball-react-js.git"&gt;https://github.com/KylesTech95/eight-ball-react-js.git&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never-ending Fun&lt;/li&gt;
&lt;li&gt;Ask 8 ball a question&lt;/li&gt;
&lt;li&gt;Answers are limited&lt;/li&gt;
&lt;li&gt;Keyboard/Touch Controls on Desktop &amp;amp; Mobile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What makes this version of Magic 8 unique?&lt;/strong&gt;&lt;br&gt;
Code is made by scratch, using pure react/javaScript.&lt;br&gt;
Please view through the presented code and let me know how you can improve my version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Magic 8 Controls&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click/tap on the input and type a question to receive a response.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>devcommunity</category>
      <category>programming</category>
    </item>
    <item>
      <title>ReactJS - Simon Says</title>
      <dc:creator>Kyle A.</dc:creator>
      <pubDate>Thu, 01 Feb 2024 16:18:15 +0000</pubDate>
      <link>https://dev.to/kylestech95/how-to-reactjs-create-simon-game-d3</link>
      <guid>https://dev.to/kylestech95/how-to-reactjs-create-simon-game-d3</guid>
      <description>&lt;p&gt;Classic Simon Says Game accessible for Desktop &amp;amp; Mobile play.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Languages&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;React JS&lt;/li&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Desktop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhshnd7rqanpv69bbf71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhshnd7rqanpv69bbf71.png" alt="simon desktop view" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/react-simon-says"&gt;https://kylestech95.github.io/react-simon-says&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/react-simon-says"&gt;https://github.com/KylesTech95/react-simon-says&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/react-simon-says.git"&gt;https://github.com/KylesTech95/react-simon-says.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Portrait&lt;/em&gt;)&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmh8n2esrqchnazp9ahm3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmh8n2esrqchnazp9ahm3.gif" alt="simon portrait mobile" width="397" height="815"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/react-simon-says"&gt;https://kylestech95.github.io/react-simon-says&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/react-simon-says"&gt;https://github.com/KylesTech95/react-simon-says&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/react-simon-says.git"&gt;https://github.com/KylesTech95/react-simon-says.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Landscape&lt;/em&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rddp2zyniszuiru3aom.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rddp2zyniszuiru3aom.gif" alt="simon landscape" width="600" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/react-simon-says"&gt;https://kylestech95.github.io/react-simon-says&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/react-simon-says"&gt;https://github.com/KylesTech95/react-simon-says&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/react-simon-says.git"&gt;https://github.com/KylesTech95/react-simon-says.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never-ending Fun&lt;/li&gt;
&lt;li&gt;Score Tracking&lt;/li&gt;
&lt;li&gt;Automatic-Type Animation (&lt;em&gt;Desktop view)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Game over screen with the option to restart&lt;/li&gt;
&lt;li&gt;Mouse/Touch Controls on Desktop &amp;amp; Mobile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Simon Controls&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Desktop: Mouse to tap&lt;/li&gt;
&lt;li&gt;Mobile: tap to touch&lt;/li&gt;
&lt;li&gt;Reset symbol - Reset game&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>devcommunity</category>
      <category>programming</category>
    </item>
    <item>
      <title>JavaScript - Mancala</title>
      <dc:creator>Kyle A.</dc:creator>
      <pubDate>Fri, 26 Jan 2024 01:35:29 +0000</pubDate>
      <link>https://dev.to/kylestech95/how-to-javascript-mancala-game-1f9a</link>
      <guid>https://dev.to/kylestech95/how-to-javascript-mancala-game-1f9a</guid>
      <description>&lt;p&gt;Classic Mancala Game accessible for Desktop &amp;amp; Mobile play.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Languages&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Desktop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcqluknhb4kliauhah8ch.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcqluknhb4kliauhah8ch.gif" alt="Mancala gameplay" width="600" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/mancala-game/"&gt;https://kylestech95.github.io/mancala-game/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/mancala-game"&gt;https://github.com/KylesTech95/mancala-game&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/mancala-game.git"&gt;https://github.com/KylesTech95/mancala-game.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Portrait&lt;/em&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93l7gi1vne1h29vjjl5v.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93l7gi1vne1h29vjjl5v.gif" alt="portrait mode mobile" width="398" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/mancala-game/"&gt;https://kylestech95.github.io/mancala-game/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/mancala-game"&gt;https://github.com/KylesTech95/mancala-game&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/mancala-game.git"&gt;https://github.com/KylesTech95/mancala-game.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Landscape&lt;/em&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yc1l8b1c4i72pb84pa6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yc1l8b1c4i72pb84pa6.gif" alt="Landscape mode mobile" width="600" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/mancala-game/"&gt;https://kylestech95.github.io/mancala-game/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/mancala-game"&gt;https://github.com/KylesTech95/mancala-game&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/mancala-game.git"&gt;https://github.com/KylesTech95/mancala-game.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never-ending Fun&lt;/li&gt;
&lt;li&gt;Score Tracking&lt;/li&gt;
&lt;li&gt;Instructions&lt;/li&gt;
&lt;li&gt;Automatic Computer play&lt;/li&gt;
&lt;li&gt;Touch &amp;amp; mouse click

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Setup:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Both you and the computer have 6 "Holes" or "Pits" on your perspective side&lt;/li&gt;
&lt;li&gt;Each pit starts with 4 marbles&lt;/li&gt;
&lt;li&gt;The colors of the marbles do not mean anything&lt;/li&gt;
&lt;li&gt;Both players are given a "goal" or a "Mancala" to the right of board.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Object:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The goal is to collect as many marbles in your "goal" by the end of the game&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Gameplay:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The game starts with you (Player) choosing a "pit" in order to grab all of your marbles&lt;/li&gt;
&lt;li&gt;Moving counter-clockwise, you place of stone in your hand into each pocket until the stones run out&lt;/li&gt;
&lt;li&gt;If you run into your own Mancala (goal), deposit one piece in it. If you run into the computer's Mancala, skip it and continue moving to the next pocket. &lt;/li&gt;
&lt;li&gt;Consistenly aim to place as many marbles as you can in your goal &lt;/li&gt;
&lt;li&gt;If you drop the last marble (in your hand) into the goal, play again &lt;/li&gt;
&lt;li&gt;The game ends when all six pockets on one side of the Mancala board are empty (Computer side or Player side) &lt;/li&gt;
&lt;li&gt;The currnet player who still has pieces on their side of the board when the game ends captures all of those pieces.&lt;/li&gt;
&lt;li&gt;Count all the pieces in each Mancala&lt;/li&gt;
&lt;li&gt;The winner is the player with the most pieces&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>gamedev</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>ReactJS - Classic Snake</title>
      <dc:creator>Kyle A.</dc:creator>
      <pubDate>Tue, 23 Jan 2024 14:02:25 +0000</pubDate>
      <link>https://dev.to/kylestech95/how-to-reactjs-create-snake-game-3ke2</link>
      <guid>https://dev.to/kylestech95/how-to-reactjs-create-snake-game-3ke2</guid>
      <description>&lt;p&gt;Classic Snake Game accessible for Desktop &amp;amp; Mobile play.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Languages&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;React JS&lt;/li&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Desktop&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7pfu8fy9takbybe1wzer.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7pfu8fy9takbybe1wzer.gif" alt="Snake game for desktop" width="600" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/snake-game/"&gt;https://kylestech95.github.io/snake-game/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/snake-game"&gt;https://github.com/KylesTech95/snake-game&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/snake-game.git"&gt;https://github.com/KylesTech95/snake-game.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Portrait&lt;/em&gt;)&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevn08pqj88iybxi8uvsu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevn08pqj88iybxi8uvsu.gif" alt="Snake play portrait view" width="444" height="714"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/snake-game/"&gt;https://kylestech95.github.io/snake-game/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/snake-game"&gt;https://github.com/KylesTech95/snake-game&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/snake-game.git"&gt;https://github.com/KylesTech95/snake-game.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mobile (&lt;em&gt;Landscape&lt;/em&gt;)&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6rh0p3ye10cwgliemjh4.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6rh0p3ye10cwgliemjh4.gif" alt="Snake play landscape view" width="600" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Play the Game:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://kylestech95.github.io/snake-game/"&gt;https://kylestech95.github.io/snake-game/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Source Code:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/snake-game"&gt;https://github.com/KylesTech95/snake-game&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Clone Ref:&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://github.com/KylesTech95/snake-game.git"&gt;https://github.com/KylesTech95/snake-game.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never-ending Fun&lt;/li&gt;
&lt;li&gt;Score Tracking&lt;/li&gt;
&lt;li&gt;Automatic-Type Animation (&lt;em&gt;Desktop view)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Game over screen with the option to restart&lt;/li&gt;
&lt;li&gt;Keyboard/Touch Controls on Desktop &amp;amp; Mobile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What makes this version of Snake unique?&lt;/strong&gt;&lt;br&gt;
As snake, you are given the chance to move through your body (provided by an empty space) without collapsing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl158f3j1bkarf5op7jdm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl158f3j1bkarf5op7jdm.gif" alt="Snake moving through body (empty space) without collapsing" width="600" height="738"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Snake Controls&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the arrow keys or W,A,S,D keys on your keyboard to update the snake's position
:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;↑ (Up) or W - Move Up&lt;br&gt;
↓ (Down) or S - Move Down&lt;br&gt;
← (Left) or A - Move Left&lt;br&gt;
→ (Right) or D - Move Right&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>devcommunity</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
