<?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: Raju Singh</title>
    <description>The latest articles on Forem by Raju Singh (@codoffer).</description>
    <link>https://forem.com/codoffer</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%2F510280%2Fd84bcafb-f51f-4818-9dff-499d5a31ba6b.jpeg</url>
      <title>Forem: Raju Singh</title>
      <link>https://forem.com/codoffer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/codoffer"/>
    <language>en</language>
    <item>
      <title>What is the difference between Local and Public disks with Laravel?</title>
      <dc:creator>Raju Singh</dc:creator>
      <pubDate>Sun, 19 Mar 2023 15:37:30 +0000</pubDate>
      <link>https://forem.com/codoffer/what-is-the-difference-between-local-and-public-disks-with-laravel-p23</link>
      <guid>https://forem.com/codoffer/what-is-the-difference-between-local-and-public-disks-with-laravel-p23</guid>
      <description>&lt;p&gt;With my team, New laravel guys are always having a simple confusion with laravel storage disks like public or local.&lt;/p&gt;

&lt;p&gt;My explanation - Laravel comes with a default disk as local. The local disk is only for storing the local files (not for a public expose).&lt;br&gt;
During the file upload process, You may mention the public disk or change the configuration via the .env file.&lt;/p&gt;

&lt;p&gt;For accessing a file URL, always use Storage::url() (The alternate way is the url() function. It will help in the future if we move or change our storage disk eg s3.&lt;/p&gt;

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

</description>
    </item>
    <item>
      <title>Functional Component vs Class Component - React JS - Which is better to use and where to use?</title>
      <dc:creator>Raju Singh</dc:creator>
      <pubDate>Mon, 15 Nov 2021 13:16:23 +0000</pubDate>
      <link>https://forem.com/codoffer/functional-component-vs-class-component-react-js-which-is-better-to-use-and-where-to-use-56oo</link>
      <guid>https://forem.com/codoffer/functional-component-vs-class-component-react-js-which-is-better-to-use-and-where-to-use-56oo</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fHWdbtwk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zg1vb7mj9yp5ghy0tluu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fHWdbtwk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zg1vb7mj9yp5ghy0tluu.png" alt="React Components" width="426" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During my react coding review or discussion with the developers, Many put their questions about Class component vs Functional component use with real-life projects. eg. Where will we have to use class/functional components and why? Which is better in terms of performance or management?&lt;/p&gt;

&lt;p&gt;Here, I am writing my experience for the above questions.&lt;/p&gt;

&lt;p&gt;In react, we are having two types of components - Functional and Class Components. Both are having different rules, ways, and strengths. Nowadays, the React hooks had given powerful methods to functional components.&lt;/p&gt;

&lt;p&gt;Currently, React Hooks are very famous to handle various tasks and manage the state in an easy way (useState, etc) like accessing state values from the parent, sharing values to child/parent components (useRef, forwardRef, useContext, etc), memory management, etc.&lt;br&gt;
Additionally, We can manage the life cycle of a component using a hook (useEffect).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Class Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;State Management: With Class components, we can easily manage the internal state values. &lt;br&gt;
For beginners, It may create complexity (a little bit tricky) with the integration of state management libraries like Redux.&lt;/p&gt;

&lt;p&gt;Before hook introduction with React, there was only one way to maintain state with components, which was class-based components.&lt;/p&gt;

&lt;p&gt;Life Cycle Management: Class components are very good with life cycle management (ComponentDidMount, ComponentWillMount, etc). It gives the power for managing life cycle stages. We can easily maintain our code with a life cycle function (attach or detach). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functional Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Functional components are stateless (without hooks) and class components are having stateful component. &lt;/p&gt;

&lt;p&gt;Without hooks, a functional component is only a viewable component (JSX without any state or stateless component).&lt;/p&gt;

&lt;p&gt;Sometimes, Developer face issue with state management with functional component. The main reason is - Hooks like (eg. useState) are having asynchronous behaviour and update state values asynchronously. It creates an issue with state handling/updating, failure state update on unmount of the component. To resolve these issues, we will have to handle state using useEffect or can use other proper way with the functional component side. &lt;/p&gt;

&lt;p&gt;Other hand with the class component, we manage these situations in a better way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;:  With Latest React, We can use both class or functional components for our development. I love the use of functional components (Easy to handle state, values, memory, data handling using hooks).&lt;br&gt;
For complex or large state management / the common components/libraries/package development, I use the class components.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Which is your favourite?&lt;/em&gt;&lt;/p&gt;

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