<?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>Forem: Mariam</title>
    <description>The latest articles on Forem by Mariam (@mariamv_96).</description>
    <link>https://forem.com/mariamv_96</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%2F320805%2Fa1874724-88f1-49e5-bb27-dafaa9e72ee0.jpg</url>
      <title>Forem: Mariam</title>
      <link>https://forem.com/mariamv_96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mariamv_96"/>
    <language>en</language>
    <item>
      <title>DOM events... lets just jump into it.</title>
      <dc:creator>Mariam</dc:creator>
      <pubDate>Mon, 12 Oct 2020 08:16:29 +0000</pubDate>
      <link>https://forem.com/mariamv_96/dom-events-lets-just-jump-into-it-304h</link>
      <guid>https://forem.com/mariamv_96/dom-events-lets-just-jump-into-it-304h</guid>
      <description>&lt;p&gt;Before you dig deep into this, Let me explain how things will go down real quick.  I will be talking about how everything went for me creating this project, then will get a bit too techy on you and talk about one particular issue that almost made me want to burn my laptop to the ground.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
I will not explain everything I did, but if you are interested, I will link the repository at the end also a video of my project, to give you a better idea.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Let me take you back to a few months ago when I decided to code 5, projects out of my comfort zone to get a feel for JavaScript because, as we all know, it’s a hell of a beast to tackle, and boy, was I afraid to experiment with it and let me tell you I was dealing with so much self-doubt.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
After looking around for ideas, I remembered I always wanted to try carousels, Although all the articles I read told me it was a bad idea since it is hard to make responsive and so many other reasons but I love a good challenge, so I went for it. &lt;br&gt;
&lt;br&gt;&lt;br&gt;
Let's fast-forward, I found a design that I liked and tweaked it a bit and started coding, and it was a smooth sailing well....&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Until the JavaScript part started especially, DOM events and all hell broke loose.&lt;/p&gt;



&lt;p&gt;I struggled a lot with everything and was feeling like a lost kid in a mall. Until I gave up and reminded myself &lt;strong&gt;asking for help is perfectly okay&lt;/strong&gt;, and some amazing people helped me out get a basic idea of how to deal with DOM event. Therefore, got over my fear to some extent. &lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Now let a newbie get a bit techy on you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2Fproxy%2Fg9i3TkRfYgNXUbQC2wKDqaJALEpgxe5iQbsyCcNWjaHkzHe9OwHTtaZhmXpNP9i_Khg4Ti4wYP95jjI3_EkfH4XuD6nPsahETv-WwzkLIc96xTkLiZJam2aSqy6zKZ_RNKzyNMVZCiTrT6lpTdu5HH1MxugigWH9Kb8" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2Fproxy%2Fg9i3TkRfYgNXUbQC2wKDqaJALEpgxe5iQbsyCcNWjaHkzHe9OwHTtaZhmXpNP9i_Khg4Ti4wYP95jjI3_EkfH4XuD6nPsahETv-WwzkLIc96xTkLiZJam2aSqy6zKZ_RNKzyNMVZCiTrT6lpTdu5HH1MxugigWH9Kb8" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you click on a carousel item, it will add a CSS class that would expand to full size, show articles content (a close button and some extra text, etc.…).&lt;br&gt;
&lt;br&gt;&lt;br&gt;
By clicking on the close button, The class will be removed, but that did not happen because of the event bubbling up and hitting all its ancestor elements, and that would include the carousel item resulting in re-adding the class immediately.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;It was an invisible issue until I caught it using the debugger.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;That’s called event bubbling and honestly, I was scratching my head like wtf is that, why was it happening and how to prevent it in the future well just code a modal pop up instead of this little hack, and maybe, things will not get this complicated, but I digress.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is event bubbling?
&lt;/h3&gt;

&lt;p&gt;When an event is triggered on an element, it first runs the handlers on it then that same event will trigger across the same element's ancestors.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fix it ?
&lt;/h3&gt;

&lt;p&gt;You need to add preventDefault and or stopPropagation into the event handlers. this stops the browser from letting the click event progress passed the event handler and hitting its parent element.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  what's the difference between preventDefault and stopPropagation?
&lt;/h3&gt;

&lt;h4&gt;
  
  
  preventDefault:
&lt;/h4&gt;

&lt;p&gt;A method that prevents the default behavior of an element, for example, if we use a button for navigation, it will prevent it from being clicked or allow the user to leave the page.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  stopPropagation :
&lt;/h4&gt;

&lt;p&gt;By default, all event handlers are registered in the bubbling phase. If you click on an element, the click event bubbles from the clicked element to the html element.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
We need to use stopPropagation it will make it so that the first handler will run, but the event does not bubble any further up the chain, meaning no more handlers will be run.&lt;/p&gt;






&lt;h4&gt;
  
  
  We made it this far let's recap what I learned from this journey:
&lt;/h4&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Asking for help does not mean you are less in anyway, in fact, it might give you a fresh perspective. &lt;br&gt;
&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don't overcomplicate stuff and always take the easier route.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always plan how to code something instead of jumping into it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;






&lt;p&gt;If you have any feedback or a suggestion about anything in this post or about how I can improve any upcoming articles. &lt;/p&gt;

&lt;p&gt;Feel free to comment below or contact me on &lt;a href="https://twitter.com/MariamV_96" rel="noopener noreferrer"&gt; Twitter!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you, for reading this far. I hope you learned a thing or two.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/MariamV_96/status/1313329811058810880" rel="noopener noreferrer"&gt;Twitter Video&lt;/a&gt; | &lt;a href="https://github.com/AfricanSoul/Evru-articles" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I want to give a shout out to everyone who helped me. &lt;br&gt;
check them out please, They have Amazing content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/ljc_dev" rel="noopener noreferrer"&gt;@ljc_dev&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/SpeakingSoftwa1" rel="noopener noreferrer"&gt;@SpeakingSoftwa1&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/inescodes" rel="noopener noreferrer"&gt;@inescodes&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/thechampsmoke" rel="noopener noreferrer"&gt;@thechampsmoke&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/L422Y" rel="noopener noreferrer"&gt;@L422Y&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>project</category>
    </item>
    <item>
      <title>so you want to be a web developer</title>
      <dc:creator>Mariam</dc:creator>
      <pubDate>Wed, 01 Jul 2020 12:15:50 +0000</pubDate>
      <link>https://forem.com/mariamv_96/so-you-want-to-be-a-web-developer-15bj</link>
      <guid>https://forem.com/mariamv_96/so-you-want-to-be-a-web-developer-15bj</guid>
      <description>&lt;p&gt;Hey, I am a newbie and only recently committed to learning web dev and today i'd like to talk about how to plan out your learning process to tackle a plethora of resources in a fast moving industry.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Well first let me tell you how things unfolded in my journey so far, after months of trying to learn everything at once while being completely overwhelmed because it was a lot and being stuck in tutorial hell and giving up and after a while, I would come back and do the same thing all over again until I decided to just dive headfirst though it was a great approach to get me coding I mean I build 6 projects so far&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.kym-cdn.com%2Fphotos%2Fimages%2Ffacebook%2F000%2F242%2F200%2F1ca.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.kym-cdn.com%2Fphotos%2Fimages%2Ffacebook%2F000%2F242%2F200%2F1ca.jpg" alt="Alt text of image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
but it created some gaps in my knowledge of the fundamentals of CSS and that lead me to bookmark every book, article, blog post, and courses that have the word CSS in it so now I don’t want to open chrome because just looking at the bookmarks made me utterly exhausted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2F4LsN0YwgIsvaU%2Fgiphy.webp%3Fcid%3Decf05e47086a77d059eee47b85b51eb533b0089c7ef2e2e9%26rid%3Dgiphy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2F4LsN0YwgIsvaU%2Fgiphy.webp%3Fcid%3Decf05e47086a77d059eee47b85b51eb533b0089c7ef2e2e9%26rid%3Dgiphy.webp" alt="Alt text of image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Then it hit me, I’m taking everything at once and not customizing it to my learning needs so I made a plan I deleted all the bookmarks (kind of a regrettable decision) ,searched for roadmaps and took so many notes of what should I learn and then I went through each subject and test my knowledge in it and if I understand it I would prove it to myself then I can cross it off the list and move on for what’s next, cool now I know what should  I focus on so I will get my resources together, organize everything out &lt;br&gt;
&lt;br&gt;&lt;br&gt;
Now we're getting into the meat and potatoes of this post &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fg0JP0HG6zF0o8%2Fgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fg0JP0HG6zF0o8%2Fgiphy.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So for 1 week I study 2 or 3 subjects and take an ungodly amount of notes and next week build something focused on what I learned then go back to my notes tidy them up and because doing that helps cement new information and see that project I did in week 1 I will go back to it and add new thing I learned to it just to see how things react together.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Lastly, keep learning, find better ways to learn, stay consistent and remember just like you plan your projects you should plan your learning process.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;By the way, this&lt;a href="https://dev.to/devindford/a-list-of-css-resources-for-beginners-2ff5"&gt; post&lt;/a&gt; by&lt;a href="https://dev.to/devindford"&gt; Devin Ford💻🚀&lt;/a&gt;&lt;a&gt;&lt;/a&gt;&lt;br&gt;
helped me out a lot in term of CSS resources check it out &lt;/p&gt;

&lt;p&gt;If you guys have other methods on how to fill the gaps in your knowledge effectively,leave a comment or hit me up on &lt;a href="https://twitter.com/MariamV_96" rel="noopener noreferrer"&gt; Twitter!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>css</category>
      <category>beginners</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
