<?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: Lucy Bullen</title>
    <description>The latest articles on DEV Community by Lucy Bullen (@loopdeluce).</description>
    <link>https://dev.to/loopdeluce</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%2F870179%2Fc16cadc9-581f-42b8-87af-2abee15f913c.jpeg</url>
      <title>DEV Community: Lucy Bullen</title>
      <link>https://dev.to/loopdeluce</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loopdeluce"/>
    <language>en</language>
    <item>
      <title>Flatiron Bootcamp - A Summer in Review</title>
      <dc:creator>Lucy Bullen</dc:creator>
      <pubDate>Thu, 25 Aug 2022 16:47:00 +0000</pubDate>
      <link>https://dev.to/loopdeluce/flatiron-bootcamp-a-summer-in-review-4k0h</link>
      <guid>https://dev.to/loopdeluce/flatiron-bootcamp-a-summer-in-review-4k0h</guid>
      <description>&lt;p&gt;As I wrap up my very last week of software engineering bootcamp, I am going to use this blog post to reflect on my goals coming into the program and the progress I have made towards achieving them.&lt;/p&gt;

&lt;p&gt;My goals coming into the program:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;embrace: your work is not your worth&lt;/li&gt;
&lt;li&gt;embrace: if you want to go somewhere fast go alone, if you want to go far, go together&lt;/li&gt;
&lt;li&gt;get through the program&lt;/li&gt;
&lt;li&gt;make friends&lt;/li&gt;
&lt;li&gt;write clean code (stretch goal)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Embrace: your work is not your worth
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Grade: 3.5/5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is something I struggle with a lot. It took leaving my job to realize how much self worth I put into being good at what I do - driving tasks to perfection and inevitable burn out. Faced with a fast-paced learning environment with a short turnaround, if I wasn't careful, this bootcamp would be a recipe for burn out. I went into camp prepared, having thought through daily structure to maximize hours away from the screen and keeping the coding, as much as possible, to 9a-6p.&lt;/p&gt;

&lt;p&gt;I was able to leave the screen, but I wasn't always able to turn off my mind - and the guilt that came with not leading a project to perfection. My tendencies caught up with me on the final project. There is so much todo! And a pesky bug can take up too much time, and all of a sudden you're behind on your self-imposed timeline. &lt;/p&gt;

&lt;p&gt;While I still struggle, I found what worked best for me, to pull me out of a state of paralysis, was consistent re-evaluation at a high level. I let the ideas flow, collecting them in a spreadsheet, but reviewed frequently. Which of these tasks were highest priority to get my app out the door? Which would enhance the app but didn't need to be there if I didn't have time? Having all ideas in one place helped drift my mind to other things in my time away from the screen and gave me bite-sized tasks to focus on .&lt;/p&gt;

&lt;p&gt;That perfectionism is still nagging at me but I'm finding more purpose outside of "work" giving me more peace and motivation when I am behind the keyboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Embrace: if you want to go somewhere fast go alone, if you want to go far, go together
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Grade: 4/5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This was a collaborative experience and I am grateful for it. Our cohort of 9 people grew close over the 15 weeks. Bugs and current "thorns" were inevitable in conversation. Rubber ducky moments abundant. This lead to intertwining ideas, solutions, etc. I'm trying to embrace the collaborative process required for what can feel like such individualized tasks in software engineering. Soft skills fascinate me - I took note on how others around me asked for help and when I appreciated how people gave help. While holing up in a corner, beating your head against the keyboard, not asking questions or for collaboration can be feel less vulnerable, I appreciated my experiences that demonstrated a richer path by involving those around you. I hope to continue that vulnerability and communication through to my next role.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get through the program
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Grade: 5/5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What you are reading, my dear, sweet reader, is the last stop between me and finishing the program. Honestly, I'm proud of myself. Tearing up as I type. This has taken guts to get this far (all of us in this bootcamp path) and is going to take more guts to keep going. But I passed all my coding challenges (with flying colors B-) ), re-discovered an interest in learning, and solidified a love of coding and logic problems along the way. I'd have a big smile showing up to bootcamp in the morning, truly (except for the days that I didn't; see above your work is not your worth turmoil). But if I do say so myself, I crushed it and can't wait to keep going.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make friends
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Grade: 5/5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My cohort was the absolute best. I was anxious coming into the bootcamp. Secretly, one reason I wanted to be in person  was to meet some new people. I can be shy to make friends and I feel so lucky to have been in a small, tight-knit cohort. They are part of what made this bootcamp such a success. We all created a safe ecosystem that pushed us to achieve and support each other. Slight tear up, love my cohort.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write clean code (stretch goal)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Grade: 3.5/5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Clean code, I am coming for you. I had an introduction reading Clean Code by Robert C Martin but I still want to see how that is put into practice in large company codebases. I crave the structure and best practice that clean code creates and more examples of how to implement it. I am just getting started though, and clean code development is what I believe I will be chasing for many years of my software engineering career.&lt;/p&gt;

&lt;p&gt;All of this feels so surreal and like I just started but also like it's been in the works for a while. I'm so happy and so proud. Please send any spare good energy my way as I journey on to land my first Software Engineering job. I'm excited to see what this future holds.&lt;/p&gt;

&lt;p&gt;Peace out,&lt;br&gt;
Lucy&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Clean Code - How I'm Refactoring My First Project</title>
      <dc:creator>Lucy Bullen</dc:creator>
      <pubDate>Thu, 14 Jul 2022 15:43:15 +0000</pubDate>
      <link>https://dev.to/loopdeluce/clean-code-how-im-refactoring-my-first-project-2523</link>
      <guid>https://dev.to/loopdeluce/clean-code-how-im-refactoring-my-first-project-2523</guid>
      <description>&lt;p&gt;I’ve been refactoring my boot camp Phase - 1 project. Here’s what I’ve learned and completed so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  The motivation
&lt;/h2&gt;

&lt;p&gt;When coding, one of the most repeated questions in my head is: “Is this even allowed?” I thrive in structure, rules and logic. Give me a template, and I am off, working methodically. &lt;/p&gt;

&lt;p&gt;Coding languages provide some of that structure, but there are so many ways to solve a problem - which is the right way? There is never a right way (unless you’re in a coding bootcamp and the tests to pass a quiz are very specific, thanks Flatiron!), so I’m choosing my right way by following someone else’s rules - Robert C. Martin.&lt;/p&gt;

&lt;p&gt;Clean Code is a coding handbook I was recommended when I started my bootcamp. In it, Martin argues messy code is the downfall of companies: “The degree of the slowdown [by messy code] can be significant. Over the span of a year or two, teams that were moving fast in the beginning of a project can be moving at a snail’s pace. Every change they make to the code breaks two or three other parts of the code. No change is trivial...As the mess builds, the productivity of the team continues to decrease, asymptotically approaching zero...[Everyone] on the team [is] under horrific pressure to increase productivity so they make more messes...” &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iX0n2Jj3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/462ryp04aqrbucegcmes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iX0n2Jj3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/462ryp04aqrbucegcmes.png" alt="Image description" width="357" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my previous career, I worked in small teams building SQL queries everyday. Over the course of 3-4 month projects, our SQL queries became very complex and debugging scripts written by others could require significant time or tribal knowledge. In the week-long projects wrapping up each of my boot camp phases, I see how quickly an application builds complexity between two people developing. &lt;/p&gt;

&lt;p&gt;Having read through 3 chapters so far, turns out the rules laid out in this book are simple in theory, but complicated to implement. Below I’ve written some of my favorites and how I’ve put them into practice in my refactored code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rules
&lt;/h2&gt;

&lt;p&gt;In choosing meaningful names...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick One Word per Concept&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Pick one word for one abstract concept and stick with it”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one is fairly easy and was already done for a good deal of the code but I choose the CRUD verb for any of my server calls. &lt;/p&gt;

&lt;p&gt;Decided on “render” when I wanted something to show up in the page, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wcx5DZEg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m87j6us2jllnyo9iqm7e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wcx5DZEg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m87j6us2jllnyo9iqm7e.png" alt="Image description" width="707" height="525"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y5RQAMu---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5h8sue7b4tg0nz5431n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y5RQAMu---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5h8sue7b4tg0nz5431n.png" alt="Image description" width="707" height="297"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3FqQPrPi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9k6wv21fun5mego1ks0l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3FqQPrPi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9k6wv21fun5mego1ks0l.png" alt="Image description" width="707" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Pronounceable Names&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“It would be a shame not to take advantage of that huge portion of our brain that has evolved to deal with spoken language”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one was also followed in our codebase but I like his example so I’ll put it here:&lt;/p&gt;

&lt;p&gt;Instead of using a date with a variable name &lt;code&gt;genymdhms&lt;/code&gt; that would be hard to relay when debugging to another developer, use &lt;code&gt;generationTimestamp&lt;/code&gt;. Or instead of &lt;code&gt;modymdhms&lt;/code&gt;, use &lt;code&gt;modificationTimestamp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In writing functions...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Small!&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“The first rule of functions is that they should be small. The second rule is that they should be smaller than that”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I broke one behemoth of a function down into smaller functions and it did wonders for the code readability.&lt;/p&gt;

&lt;p&gt;Below is before, functions calling functions; requiring the reader to understand the chain of functions to get an idea of what all is happening:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w-6FNF8z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8n9yd5yoj1ydr4tb42dx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w-6FNF8z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8n9yd5yoj1ydr4tb42dx.png" alt="Image description" width="707" height="794"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b6mVmgke--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq1jvfvgid7d2aqqw1tv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b6mVmgke--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq1jvfvgid7d2aqqw1tv.png" alt="Image description" width="707" height="731"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here it is after, still long but much more readable:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t6f4JjOz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssqtlmx27ysrh1f3udt6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t6f4JjOz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssqtlmx27ysrh1f3udt6.png" alt="Image description" width="707" height="869"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S04QINYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zz1ztg82v913vya1k3jo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S04QINYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zz1ztg82v913vya1k3jo.png" alt="Image description" width="707" height="525"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do One Thing&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Functions should do one thing. They should do it well. They should do it only.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When I read this, I nodded my head and took note. But when I started to think about it more, what is “one thing?” Martin acknowledges this and elaborates: “we want to be able to read the program as though it were a set of TO paragraphs, each of which is describing the current level of abstraction and referencing subsequent TO paragraphs at the next level down”&lt;/p&gt;

&lt;p&gt;Let’s revisit my code sample from the above Small! Section; I tried to break that down into TO  paragraphs below:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To show all the movie details we get the movie details, then render the movie data, then we get the user data for the movie then we render the user data.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To render user movie details we render the rating and watch status, then we remove the previous movie comments, then render the current movie comments.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To render the rating and watch status...&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You get the point. But overall, when implemented it results in easily readable code.    &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Descriptive Names&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“A long descriptive name is better than a long descriptive comment”&lt;br&gt;
“A function name can go a long way toward explaining the intent of the function and the order and intent of the arguments”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I like descriptive names, I like being encouraged to write long ones, but when is it too far? Let’s take a poll. &lt;/p&gt;

&lt;p&gt;I liked the idea of explaining the order and intent of the arguments. Here are two functions that have similar purposes for two sets of data. Is it enough to define the function as coalesce? Or is it clearer to write consolidateExistingAndNew? Is my second name overkill? I like it because it tells me the order my arguments should be added to the function. Let me know what you think.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4dgV4xJw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yf80lybzyib2memn6edc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4dgV4xJw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yf80lybzyib2memn6edc.png" alt="Image description" width="707" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overwhelmed? Me too. Here are two things that give me hope:&lt;/p&gt;

&lt;p&gt;1 - Martin argues that the overall goal of code is “to tell the story of a system”&lt;/p&gt;

&lt;p&gt;That gets my head nodding and helps put all coding into context.&lt;/p&gt;

&lt;p&gt;2 - Martin admits to writing sloppy first drafts of code but then he massages and refines the code to eventually follow the rules he’s laid out. But, and it’s a big but, he doesn’t write that way to start and doesn’t think anyone could&lt;/p&gt;

&lt;p&gt;That takes the pressure off and motivates me to continue analyzing my code to help out future me, and anyone else looking at my code.&lt;/p&gt;

&lt;p&gt;It’s worth mentioning again - these concepts (including the productivity v. time graphic) are entirely Robert C. Martin’s wonderful work documented in his book Clean Code and are in no way my own. This article serves to describe my journey to finding the value in his work and how I attempt to implement it in my own coding practice.&lt;/p&gt;

&lt;p&gt;If you are interested, a pdf of the book is here: &lt;a href="https://yes-pdf.com/book/1038"&gt;https://yes-pdf.com/book/1038&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>cleancode</category>
      <category>refactorit</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React Context API - an Implementation Quick Guide</title>
      <dc:creator>Lucy Bullen</dc:creator>
      <pubDate>Wed, 22 Jun 2022 22:19:53 +0000</pubDate>
      <link>https://dev.to/loopdeluce/react-context-an-implementation-quick-guide-475n</link>
      <guid>https://dev.to/loopdeluce/react-context-an-implementation-quick-guide-475n</guid>
      <description>&lt;p&gt;Implementing the React Context API is one way to implement &lt;strong&gt;global state&lt;/strong&gt; in an application. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Global state&lt;/strong&gt; is useful when there are child components that need access to the same piece of state nested in disjointed areas of the component tree. Examples of this include: the toggling of a dark mode layout and accessing user information for personalized application formatting. &lt;/p&gt;

&lt;p&gt;The local state management methodology calls for this to be solved using &lt;strong&gt;prop drilling&lt;/strong&gt; - defining state at a shared higher level component and passing the variable down to child components, and child components' child components, using props. With a complex component tree, it can be clunky to pass the state variable as props and inefficient to re-render the entire shared higher level component each time a child component updates state. Enter React Context API for global state management. It allows children components to have access to state variables and state variables' relevant functions without explicitly passing them through the component tree by making them 'global.'&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Other global statement management solutions are out of the scope of this article, but learn more about other popular options here: &lt;a href="https://javascript.works-hub.com/learn/state-management-battle-in-react-hooks-redux-and-recoil-9977a"&gt;State Management Battle in React 2022: Hooks, Redux, and Recoil&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The syntax required for the React Context API global state management consists of: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the createContext object&lt;/li&gt;
&lt;li&gt;the context provider component&lt;/li&gt;
&lt;li&gt;the useContext hook&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  the createContext object
&lt;/h2&gt;

&lt;p&gt;The createContext object initializes the use of context in a React application.&lt;/p&gt;

&lt;p&gt;To create the createContext object, import React and set a constant equal to React.createContext().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';

const GlobalContext = React.createContext();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  the context provider component
&lt;/h2&gt;

&lt;p&gt;The context provider component is how global state, and its' relevant functions, are &lt;em&gt;provided&lt;/em&gt; to other components in a React application.&lt;/p&gt;

&lt;p&gt;In the same file as the createContext object, create a context provider component. Assuming function component syntax; the function should take in the component's children as props and return JSX with a parent component encompassing the children props. Set the name of the parent component equal to the createContext object with .Provider added to the end and pass it a value prop. The value prop will hold the global state relevant data being passed to the children components.&lt;/p&gt;

&lt;p&gt;Export the createContext object and the context provider component for use in other areas of the application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, {useState} from 'react';

const GlobalContext = React.createContext();

function GlobalProvider({ children }) {
    const [global, setGlobal] = useState(false);

    return (
        &amp;lt;GlobalContext.Provider value={global}&amp;gt;
            {children}
        &amp;lt;/GlobalContext.Provider&amp;gt;
    );
};

export default GlobalProvider;
export { GlobalContext };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make the global state data available to other components in the application, import the context provider component and wrap it around the components that require the global state.&lt;/p&gt;

&lt;p&gt;For the purpose of this example, Item is a component rendered in ItemList and needs access to the global variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import Item from "./Item";
import GlobalProvider from '../context/global';


function ItemList() {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;GlobalProvider&amp;gt;
        &amp;lt;Item /&amp;gt;
      &amp;lt;/GlobalProvider&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default ItemList;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For setting global state, the goal of the provider component object is to house all setState functions related to the global state variable. This minimizes de-bugging time - any changes to a particular state occur will in one file. To separate out the global state from other sections of code, create a context folder and a new file for each separate section of global state. To pass functions that interact with the global state to other components in the application, create an object that holds the global states and their associated functions, and pass the object into the values prop of the context provider component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

const GlobalContext = React.createContext();

function GlobalProvider({ children }) {
  const [global, setGlobal] = useState(false);

  function handleClick() {
    setGlobal((global) =&amp;gt; !global);
    console.log('This is an example function that interacts 
       with the global state variable global');
  };

  const value = {
    global,
    handleClick
  };

  return (
    &amp;lt;GlobalContext.Provider value={value}&amp;gt;
       {children}
    &amp;lt;/GlobalContext.Provider&amp;gt;
    );
};

export default GlobalProvider;
export { GlobalContext };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  the useContext hook
&lt;/h2&gt;

&lt;p&gt;The useContext hook in React is how components access the global state created.&lt;/p&gt;

&lt;p&gt;Import the useContext hook and the createContext object. Destructure the value prop passed to the context provider component and set it equal to the useContext hook with an argument of the createContext object. This will give the component explicit access to any of the global state relevant data passed into the context provider component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext } from "react";
import { GlobalContext } from '../context/global';

function Item() {
  const { global, handleClick } = useContext(GlobalContext);  

  return (
    &amp;lt;div&amp;gt;
      {global ? &amp;lt;h2&amp;gt;the global state variable is true&amp;lt;/h2&amp;gt; 
         : &amp;lt;h2&amp;gt;the global state variable is false&amp;lt;/h2&amp;gt;}
      &amp;lt;button onClick={handleClick}&amp;gt;Change the value of 
         global&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Item;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Happy global state management!&lt;/p&gt;

&lt;p&gt;For more documentation on useContext check out the React Docs documentation: &lt;a href="https://reactjs.org/docs/context.html"&gt;React Docs - Context&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>statemanagement</category>
      <category>webdev</category>
    </item>
    <item>
      <title>9 Useful Visual Studio Code Shortcuts for Beginners (with Gif Demos)</title>
      <dc:creator>Lucy Bullen</dc:creator>
      <pubDate>Thu, 02 Jun 2022 15:46:22 +0000</pubDate>
      <link>https://dev.to/loopdeluce/9-useful-visual-studio-shortcuts-for-beginners-3cdh</link>
      <guid>https://dev.to/loopdeluce/9-useful-visual-studio-shortcuts-for-beginners-3cdh</guid>
      <description>&lt;p&gt;&lt;em&gt;A compiled list of the best visual studio code (version 1.65.2) tricks I have been taught or googled.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Create multiple cursors&lt;/strong&gt;: command d&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Copy and paste a line of code&lt;/strong&gt;: (place cursor at the end of the line) shift option up-arrow &lt;strong&gt;/&lt;/strong&gt; shift option down-arrow&lt;/li&gt;
&lt;li&gt;"&lt;strong&gt;Stringify&lt;/strong&gt;" &lt;strong&gt;rogue datatypes&lt;/strong&gt;: (highlight the word) '&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Toggle comments&lt;/strong&gt;: control /&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrap text&lt;/strong&gt;: option z&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get more error details&lt;/strong&gt;: shift command m&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Color parentheses and brackets&lt;/strong&gt;: enable "Bracket Pair Colorization"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shift blocks of code vertically&lt;/strong&gt;: option up-arrow &lt;strong&gt;/&lt;/strong&gt; option down-arrow&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shift blocks of horizontally&lt;/strong&gt;: tab &lt;strong&gt;/&lt;/strong&gt; shift tab&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Create multiple cursors
&lt;/h2&gt;

&lt;p&gt;Have you ever needed to edit the name of a variable but it exists in many places in your code? Use &lt;strong&gt;command d&lt;/strong&gt; to capture successive instances of that variable name and edit them all at once. However, proceed with caution, this will capture instances even if they are nested in a larger word. For example, using &lt;strong&gt;command d&lt;/strong&gt; on &lt;em&gt;book&lt;/em&gt; will also capture book in a variable name &lt;em&gt;bookReview&lt;/em&gt; or &lt;em&gt;bookTitle&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQTTsnft--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07x3omepscfmidce2l12.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQTTsnft--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07x3omepscfmidce2l12.gif" alt="Gif demonstrating creating multiple cursors in visual studio" width="600" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Copy and paste a line of code
&lt;/h2&gt;

&lt;p&gt;This shortcut is good for writing similar lines of code one after the other. Save some control c + enter + control z time and use &lt;strong&gt;shift option down-arrow&lt;/strong&gt; to quickly copy a line of code onto the next line below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qInf-4Dl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j83qe9rbxkvj0y4pwmm7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qInf-4Dl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j83qe9rbxkvj0y4pwmm7.gif" alt="Gif demonstrating copy/pasting a line of code with one keyboard shortcut" width="600" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  "Stringify" rogue datatypes
&lt;/h2&gt;

&lt;p&gt;Sometimes an array will be created with or a variable will be assigned to string-like values not wrapped in quotes. JavaScript will interpret these values as other variables, not strings. Avoid awkwardly adding quotes and copy-pasting the values in between them; instead &lt;strong&gt;highlight the value&lt;/strong&gt; and type either a single quote &lt;strong&gt;'&lt;/strong&gt; or double quote &lt;strong&gt;"&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qk6v-p77--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/norsk7z07xh0pew3f9lx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qk6v-p77--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/norsk7z07xh0pew3f9lx.gif" alt="gif demonstrating stringifying rogue datatypes" width="600" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Toggle comments
&lt;/h2&gt;

&lt;p&gt;For me, toggling comments has been a valuable tool for documenting code processes and debugging sections of code. &lt;strong&gt;Command /&lt;/strong&gt; on a block of code applies the correct comment syntax no matter what language is being used. It saves both the time spent googling comment syntax and the time applying comment syntax to each individual line of code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wSvP4Bir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60ormnxpfela7uqcxxal.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wSvP4Bir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60ormnxpfela7uqcxxal.gif" alt="gif demonstrating toggling comments with a keyboard shortcut" width="600" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap text
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Option z&lt;/strong&gt; is great when working on a file between two different screen or font sizes. Don't take the time to find an optimal break point on a long comment or line of code; let Visual Studio Code do the work resizing the words per line for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DNJq38Zt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1xokmmb9r1mqfor570mt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DNJq38Zt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1xokmmb9r1mqfor570mt.gif" alt="gif demonstrating wrapping code with a keyboard shortcut" width="600" height="115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Get more error details
&lt;/h2&gt;

&lt;p&gt;The more information that can be provide on errors, the better. Often my indicator that something is incorrect is when my file name tab turns red. I then scan the file for red squiggles in the code or blatant syntax issues. &lt;strong&gt;Shift command m&lt;/strong&gt; eliminates the code scanning. Clicking on each error detail shown highlights the suspicious error line and helps debugging move faster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b_RmEJZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j66di7gmowonm8bjhmln.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b_RmEJZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j66di7gmowonm8bjhmln.gif" alt="gif demonstrating the error details that can be pulled up" width="600" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Color parentheses and brackets
&lt;/h2&gt;

&lt;p&gt;Not only does this trick save me from squinting at my code and counting open brackets under my breath, it has also decreased the time I spend debugging syntax errors. &lt;strong&gt;Enabling Bracket Pair Colorization&lt;/strong&gt; provides an interactive visual aid. Suppose you have a function that creates an array of dictionaries, each dictionary having some value equal to another array - that's at least 4 sets of brackets right there. &lt;strong&gt;Bracket Pair Colorization&lt;/strong&gt; gives each set a unique color allowing you to quickly spot unclosed or out of order brackets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ay7amGw4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5klrcsjqy7yg3y9yjekz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ay7amGw4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5klrcsjqy7yg3y9yjekz.gif" alt="gif enabling bracket pair colorization in the settings" width="600" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Shift blocks of code vertically
&lt;/h2&gt;

&lt;p&gt;Shifting blocks of code with &lt;strong&gt;option up-arrow&lt;/strong&gt; or &lt;strong&gt;option down-arrow&lt;/strong&gt; is useful for moving code blocks in and out of different functions or moving them to entirely different locations in the code, all while maintaining the correct indentation. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nNytTe7---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3ijho9h3h3hxfk0buui.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nNytTe7---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3ijho9h3h3hxfk0buui.gif" alt="gif shifting code blocks vertically" width="600" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Shift blocks of code horizontally
&lt;/h2&gt;

&lt;p&gt;This final trick is for keeping code clean and readable. Highlighting a section of code and using &lt;strong&gt;tab&lt;/strong&gt; or &lt;strong&gt;shift tab&lt;/strong&gt; will indent or outdent respectively all at once. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oJPXebx9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ictwaggs8vpv84rrhn7r.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oJPXebx9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ictwaggs8vpv84rrhn7r.gif" alt="gif shifting code blocks horizontally" width="600" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Special thanks to my teachers who've shown me tricks and/or sent me resources: Ix Procopios, Sam Waters, and Bryan Fowler!&lt;/p&gt;

&lt;p&gt;For more shortcuts check out the following:&lt;br&gt;
(&lt;a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf"&gt;https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf&lt;/a&gt;)&lt;br&gt;
(&lt;a href="https://code.visualstudio.com/docs/getstarted/tips-and-tricks"&gt;https://code.visualstudio.com/docs/getstarted/tips-and-tricks&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>visualstudiocode</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
