<?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: Sheila Kabiro</title>
    <description>The latest articles on DEV Community by Sheila Kabiro (@shyeecodes).</description>
    <link>https://dev.to/shyeecodes</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%2F721136%2F7358eba9-49c9-44e8-8554-18c2474585ad.png</url>
      <title>DEV Community: Sheila Kabiro</title>
      <link>https://dev.to/shyeecodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shyeecodes"/>
    <language>en</language>
    <item>
      <title>Understanding state and props in React</title>
      <dc:creator>Sheila Kabiro</dc:creator>
      <pubDate>Fri, 02 Feb 2024 09:01:27 +0000</pubDate>
      <link>https://dev.to/luxdevhq/understanding-state-and-props-in-react-4hfa</link>
      <guid>https://dev.to/luxdevhq/understanding-state-and-props-in-react-4hfa</guid>
      <description>&lt;p&gt;State and props are two essential ideas in the world of React that are crucial to creating dynamic and interactive user interfaces. React's component-based architecture is based on these concepts, which allow programmers to write reusable, modular, and maintainable code. We'll go on a journey to understand the relevance and smooth operation of React's state and props, simplifying their enchantment in this article. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Role of State:&lt;br&gt;
What is the State?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At its core, state in React represents the local mutable data that a component manages. It is what allows a component to keep track of information that can change over time – from user interactions, API responses, or any other dynamic aspect of the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Class Components and State:&lt;/strong&gt;&lt;br&gt;
Traditionally, class components were the primary way to manage state in React. The &lt;code&gt;setState&lt;/code&gt;  method played a crucial role in updating and re-rendering components based on changes in state. Understanding the component lifecycle methods became essential to grasp the intricacies of managing state effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introducing Hooks:&lt;/strong&gt;&lt;br&gt;
With the advent of React Hooks, especially the useState hook, functional components gained the ability to manage state. This simplified the state management process, making code cleaner and more concise. No longer bound to class components, developers could harness the power of state within functional components effortlessly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key characteristics of state:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Internal to a component.&lt;/li&gt;
&lt;li&gt;Mutable: can be changed using setState.&lt;/li&gt;
&lt;li&gt;Represents dynamic data that affects the component's behavior.&lt;/li&gt;
&lt;li&gt;Example: Clicking a button in the Counter component might call setState to increment the count.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Significance of Props:&lt;br&gt;
What are Props?&lt;/strong&gt;&lt;br&gt;
Props, short for properties, allow components to receive data from their parent components. They are immutable and serve as a way to pass information down the component tree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Passing and Receiving Props:&lt;/strong&gt;&lt;br&gt;
Props are passed from parent to child components, creating a flow of data within the application. This unidirectional data flow ensures that child components remain predictable and easily maintainable.&lt;/p&gt;

&lt;p&gt;Key characteristics of props:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Passed from parent to child components.&lt;/li&gt;
&lt;li&gt;Read-only.&lt;/li&gt;
&lt;li&gt;Used to configure a component's behavior or appearance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Yin and Yang of React Data Flow&lt;br&gt;
Interaction Between State and Props&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Props and state work together seamlessly to create responsive and dynamic user interfaces. Props provide external configuration, while state manages internal data changes. Here's a helpful analogy:&lt;/p&gt;

&lt;p&gt;Props are like the recipe: Just as a recipe provides instructions on how to bake a cake, props in React provide the necessary information for a component. They are passed down from parent components to child components and are immutable within the component receiving them. Props define what a component should render and how it should behave based on external input.&lt;/p&gt;

&lt;p&gt;State is like the ingredients: While the recipe (props) provides the blueprint, the ingredients (state) are the dynamic elements that can change the outcome of the cake. State is internal to a component and represents its current condition or situation. It can be modified by the component itself through setState(), leading to re-rendering and updates in the component's UI.&lt;/p&gt;

&lt;p&gt;Common Use Cases: When to Use Props vs. State&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use props for data that comes from a parent component and shouldn't be changed by the child.&lt;/li&gt;
&lt;li&gt;Use state for data that is internal to the component and can change over time.&lt;/li&gt;
&lt;li&gt;Props are ideal for static configuration, while state is perfect for dynamic behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anybody starting to build modern web applications needs to understand state and props in React. Developers may design dynamic, interactive, and maintainable user interfaces by grasping these concepts. Remember that state and props are your buddies when you start your React journey; they will enable you to easily create applications that are reliable and scalable. Happy coding!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>LESSONS I HAD TO LEARN THE HARD WAY</title>
      <dc:creator>Sheila Kabiro</dc:creator>
      <pubDate>Tue, 31 May 2022 11:09:45 +0000</pubDate>
      <link>https://dev.to/shyeecodes/lessons-i-had-to-learn-the-hard-way-3j1i</link>
      <guid>https://dev.to/shyeecodes/lessons-i-had-to-learn-the-hard-way-3j1i</guid>
      <description>&lt;p&gt;I’ve been into coding for the last 3 years now. I’m far from an excellent developer, but I’ve definitely learned some things about being an average one. ? or so I think. A lot has changed about me and I want to believe that code has changed me. In programming, there are many lessons to be learned from experience. I had to learn the following lessons the hard way and sharing them here is the least I can do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No one knows everything&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From searching for solutions with my lectures on the internet to sharing ideas with senior developers and teammates, I have come to conclude we can’t know everything in coding. There is so much more to being a developer than knowing by heart every line of code that there is. It doesn’t matter if you know the little things, they are a google search away if you forget them.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How to Improve on This?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improve your problem solving skills&lt;/li&gt;
&lt;li&gt;Improve your teamwork and communication skills&lt;/li&gt;
&lt;li&gt;Increase your Knowledge of programming concepts and frameworks&lt;/li&gt;
&lt;li&gt;Clean code should be a main focus&lt;/li&gt;
&lt;li&gt;Create an Outstanding Portfolio&lt;/li&gt;
&lt;li&gt;The great thing about being a developer is that you don’t need to know everything. You only need to know how to solve problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Having bugs is essential to learning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Bugs I experienced in 2019 are now almost a walk through but what am learning today seems to be so challenging that I sometimes feel like giving up. In Coding you must come across bugs, how you debug your code is what matters.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Don’t even start considering solutions until you understand the problem. Your goal should be to “solve” the problem mostly within the problem domain, not the solution domain.” — Oz Nova&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;DTIW ( Don’t touch, if it works )&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don’t touch your code if it is working, especially in your testing phase or when you do practice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Think Twice, Code Once&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before writing any code, I have trained my mind to think about the code and write it down in pen and paper if I have to. After getting a solution or approach to the code, I then get confident to write my code. Test driven development promotes this greatly as you have to think about what functionality you expect and how it’ll work. You can’t freehand the code when you have to plan it ahead of time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Googling is a legitimate skill&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Coding is all about finding solutions and Google has it all. Improving your skills on searching, saves a developer a lot of time. Sometimes, you need to find a solution to a problem you don’t even understand. But thankfully, Google has the answer somewhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Good Programmer Looks Both Ways Before Crossing a One-Way Street&lt;br&gt;
The best software can handle all errors, and I mean all. Even those that “will never happen.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most software is written to carry out the “good flow” in which everything works as expected and the user doesn’t do weird stuff. The real world is messy, and over time, stuff that can possibly go wrong will go wrong. Try to catch as many errors as you can — especially when your software is fulfilling crucial functionality. Remember If you find software or application that has low or reduced performance, you will find that it brings your reputation down in the market. Users are not going to trust any people. There are chances that the reputation of your organization is going to suffer.&lt;/p&gt;

&lt;p&gt;Measuring Programming Progress by Lines of Code Is Like Measuring Aircraft Building Progress by Weight -Bill Gates&lt;br&gt;
Writing more code than others does not mean you’re more productive. The best code uses the least amount of lines to get the job done. However, this code is also the hardest to write. Most people thing programming is just writing code and making it happen just like in the movies.&lt;/p&gt;

&lt;p&gt;KISS(Keep it Simple Stupid). Don’t write a code that is super complex and hard to understand. Keep it as simple as much as you can.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How to be the best?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;One Advantage of being in the Tech industry is the freedom to live in the Internet. You get different resources and communities that shape you to be a better developer. Developers are different. We love to write code. We love to build the next biggest things using code. Twitter, Instagram and Pinterest are a few examples of code that has changed the world. But there is a dark side to that. Writing code requires countless hours sitting in front of the computer and hence we do not spend enough time to socialize and to network. Many of us also build ego or pride. We live in our own little world. Many of us are not so social and have a shy nature. And many of us just don’t know where to go and find the right network. If you want to grow out of being a developer and want to become more than that, CTO or manager, or even start your own business, you will need to think and act differently. You will need to give up your pride and/or ego.&lt;/p&gt;

&lt;p&gt;Finding a mentor is the key. Mentorship is the best way to get on the track. For a mentor, you must find somebody who believes in you and who sees your potential beyond you. Once you find the right mentor, you must respect their opinion and guidance. When reaching out for help, you should be very polite. Remember, you’re in need. There are chances you may not get any response or help for a while or maybe never but don’t be discouraged. Find somebody else and keep trying.&lt;/p&gt;

&lt;p&gt;Remember, even though most successful people are willing to help, they are usually very full of activity. You’re not the only person contacting them. For you, your need may be the most important task but for them, it’s not. Try to fit into their shoes for a moment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, how do I ask for help?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The best way to ask for help is try to build a relationship. You can’t just randomly go to somebody you have never met and ask for help. The chances of getting any help are very slim. But if you introduce yourself and be polite and listen, learn and get a temperature of the person and politely ask when the time is right.&lt;/p&gt;

&lt;p&gt;So there you go fam, 8 lessons I have had to learn in the last 3 years. Has it been easy? Clearly no still isn’t but its the bugs that make us know how to solve something. Keep on pushing, Don’t Complain&lt;/p&gt;

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