<?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: Asif Vora</title>
    <description>The latest articles on DEV Community by Asif Vora (@007_dark_shadow).</description>
    <link>https://dev.to/007_dark_shadow</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%2F346617%2F76582db1-4457-4602-8b2c-115cf5f9b564.jpg</url>
      <title>DEV Community: Asif Vora</title>
      <link>https://dev.to/007_dark_shadow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/007_dark_shadow"/>
    <language>en</language>
    <item>
      <title>API Status code</title>
      <dc:creator>Asif Vora</dc:creator>
      <pubDate>Wed, 21 Jun 2023 05:29:24 +0000</pubDate>
      <link>https://dev.to/007_dark_shadow/api-status-code-l1a</link>
      <guid>https://dev.to/007_dark_shadow/api-status-code-l1a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Status Codes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HTTP status codes are three-digit numbers returned by a server to indicate the status of a requested HTTP transaction. Here are some common status codes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1XX Informational:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  100 Continue&lt;/li&gt;
&lt;li&gt;  101 Switching Protocols&lt;/li&gt;
&lt;li&gt;  102 Processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2XX Success:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  200 OK&lt;/li&gt;
&lt;li&gt;  201 Created&lt;/li&gt;
&lt;li&gt;  202 Accepted&lt;/li&gt;
&lt;li&gt;  203 Non-authoritative Information&lt;/li&gt;
&lt;li&gt;  204 No Content&lt;/li&gt;
&lt;li&gt;  205 Reset Content&lt;/li&gt;
&lt;li&gt;  206 Partial Content&lt;/li&gt;
&lt;li&gt;  207 Multi-Status&lt;/li&gt;
&lt;li&gt;  208 Already Reported&lt;/li&gt;
&lt;li&gt;  226 IM Used&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3XX Redirectional:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  300 Multiple Choices&lt;/li&gt;
&lt;li&gt;  301 Moved Permanently&lt;/li&gt;
&lt;li&gt;  302 Found&lt;/li&gt;
&lt;li&gt;  303 See Other&lt;/li&gt;
&lt;li&gt;  304 Not Modified&lt;/li&gt;
&lt;li&gt;  305 Use Proxy&lt;/li&gt;
&lt;li&gt;  307 Temporary Redirect&lt;/li&gt;
&lt;li&gt;  308 Permanent Redirect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4XX Client Error:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  400 Bad Request&lt;/li&gt;
&lt;li&gt;  401 Unauthorized&lt;/li&gt;
&lt;li&gt;  402 Payment Required&lt;/li&gt;
&lt;li&gt;  403 Forbidden&lt;/li&gt;
&lt;li&gt;  404 Not Found&lt;/li&gt;
&lt;li&gt;  405 Method Not Allowed&lt;/li&gt;
&lt;li&gt;  406 Not Acceptable&lt;/li&gt;
&lt;li&gt;  407 Proxy Authentication Required&lt;/li&gt;
&lt;li&gt;  408 Request Timeout&lt;/li&gt;
&lt;li&gt;  409 Conflict&lt;/li&gt;
&lt;li&gt;  410 Gone&lt;/li&gt;
&lt;li&gt;  411 Length Required&lt;/li&gt;
&lt;li&gt;  412 Precondition Failed&lt;/li&gt;
&lt;li&gt;  413 Payload Too Large&lt;/li&gt;
&lt;li&gt;  414 Request-URI Too Long&lt;/li&gt;
&lt;li&gt;  415 Unsupported Media Type&lt;/li&gt;
&lt;li&gt;  416 Requested Range Not Satisfiable&lt;/li&gt;
&lt;li&gt;  417 Expectation Failed&lt;/li&gt;
&lt;li&gt;  418 I'm a teapot&lt;/li&gt;
&lt;li&gt;  421 Misdirected Request&lt;/li&gt;
&lt;li&gt;  422 Unprocessable Entity&lt;/li&gt;
&lt;li&gt;  423 Locked&lt;/li&gt;
&lt;li&gt;  424 Failed Dependency&lt;/li&gt;
&lt;li&gt;  426 Upgrade Required&lt;/li&gt;
&lt;li&gt;  428 Precondition Required&lt;/li&gt;
&lt;li&gt;  429 Too Many Requests&lt;/li&gt;
&lt;li&gt;  431 Request Header Fields Too Large&lt;/li&gt;
&lt;li&gt;  444 Connection Closed Without Response&lt;/li&gt;
&lt;li&gt;  451 Unavailable For Legal Reasons&lt;/li&gt;
&lt;li&gt;  499 Client Closed Request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5XX Server Error:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  500 Internal Server Error&lt;/li&gt;
&lt;li&gt;  501 Not Implemented&lt;/li&gt;
&lt;li&gt;  502 Bad Gateway&lt;/li&gt;
&lt;li&gt;  503 Service Unavailable&lt;/li&gt;
&lt;li&gt;  504 Gateway Timeout&lt;/li&gt;
&lt;li&gt;  505 HTTP Version Not Supported&lt;/li&gt;
&lt;li&gt;  506 Variant Also Negotiates&lt;/li&gt;
&lt;li&gt;  507 Insufficient Storage&lt;/li&gt;
&lt;li&gt;  508 Loop Detected&lt;/li&gt;
&lt;li&gt;  510 Not Extended&lt;/li&gt;
&lt;li&gt;  511 Network Authentication Required&lt;/li&gt;
&lt;li&gt;  599 Network Connect Timeout Error&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Optimize React Application Performance</title>
      <dc:creator>Asif Vora</dc:creator>
      <pubDate>Thu, 29 Sep 2022 12:18:26 +0000</pubDate>
      <link>https://dev.to/007_dark_shadow/optimize-react-application-performance-3156</link>
      <guid>https://dev.to/007_dark_shadow/optimize-react-application-performance-3156</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Use the Production Build&lt;/li&gt;
&lt;li&gt;Profiling Components with the DevTools Profiler&lt;/li&gt;
&lt;li&gt;Virtualize Long Lists (hundreds or thousands of rows) - react-window / react-virtualized&lt;/li&gt;
&lt;li&gt;Avoid Reconciliation / Re-randor - shouldComponentUpdate&lt;/li&gt;
&lt;li&gt;Not Mutating Data&lt;/li&gt;
&lt;li&gt;Code Splitting - Multiple Chunk Files&lt;/li&gt;
&lt;li&gt;Lazy Loading - Dynamic import&lt;/li&gt;
&lt;li&gt;Lazy loading images in React&lt;/li&gt;
&lt;li&gt;Use Route-Based Code Splitting&lt;/li&gt;
&lt;li&gt;Avoid dangerouslySetInnerHTML&lt;/li&gt;
&lt;li&gt;Dependency optimization - Moment.js / loadash / UI lib &lt;/li&gt;
&lt;li&gt;Use React Fragments to Avoid Extra Tag&lt;/li&gt;
&lt;li&gt;Avoid Async Initialization in componentWillMount() use componentDidMount()&lt;/li&gt;
&lt;li&gt;Memoize React Components - React.PureComponent / React.memo &lt;/li&gt;
&lt;li&gt;useMemo&lt;/li&gt;
&lt;li&gt;useCallback&lt;/li&gt;
&lt;li&gt;Throttling and Debouncing Events&lt;/li&gt;
&lt;li&gt;Create Error Boundaries for the Components&lt;/li&gt;
&lt;li&gt;Avoid using Index as Key for map - Using a Unique Key for Iteration&lt;/li&gt;
&lt;li&gt;CSS Animation Instead of JavaScript Animation&lt;/li&gt;
&lt;li&gt;Analyzing and Optimizing Your Webpack Bundle Bloat&lt;/li&gt;
&lt;li&gt;Consider Server-side Rendering&lt;/li&gt;
&lt;li&gt;Enable Gzip Compression on Web Server&lt;/li&gt;
&lt;li&gt;Using a CDN - React / ReactDOM &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>performance</category>
      <category>build</category>
    </item>
    <item>
      <title>React Hooks calling child component method from parent</title>
      <dc:creator>Asif Vora</dc:creator>
      <pubDate>Wed, 25 Aug 2021 11:13:49 +0000</pubDate>
      <link>https://dev.to/007_dark_shadow/react-hooks-calling-child-component-method-from-parent-144p</link>
      <guid>https://dev.to/007_dark_shadow/react-hooks-calling-child-component-method-from-parent-144p</guid>
      <description>&lt;p&gt;For calling Child Component method from parent component in hooks we are using &lt;a href="https://reactjs.org/docs/react-api.html#reactforwardref" rel="noopener noreferrer"&gt;React.forwardRef&lt;/a&gt; and  &lt;a href="https://reactjs.org/docs/hooks-reference.html#useimperativehandle" rel="noopener noreferrer"&gt;React.useImperativeHandle&lt;/a&gt; hooks from React.&lt;/p&gt;

&lt;h1&gt;
  
  
  React.forwardRef
&lt;/h1&gt;

&lt;p&gt;React.forwardRef creates a React component that forwards the ref attribute it receives to another component below in the tree. This technique is not very common but is particularly useful in two scenarios:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/forwarding-refs.html#forwarding-refs-to-dom-components" rel="noopener noreferrer"&gt;Forwarding refs to DOM components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/forwarding-refs.html#forwarding-refs-in-higher-order-components" rel="noopener noreferrer"&gt;Forwarding refs in higher-order-components&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;React.forwardRef accepts a rendering function as an argument. React will call this function with props and ref as two arguments. This function should return a React node.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnxmcadgo0wpdk28z25h.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnxmcadgo0wpdk28z25h.png" alt="Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more information, see &lt;a href="https://reactjs.org/docs/forwarding-refs.html" rel="noopener noreferrer"&gt;forwarding refs&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  React.useImperativeHandle
&lt;/h1&gt;

&lt;p&gt;useImperativeHandle customizes the instance value that is exposed to parent components when using ref. As always, imperative code using refs should be avoided in most cases. useImperativeHandle should be used with &lt;a href="https://reactjs.org/docs/react-api.html#reactforwardref" rel="noopener noreferrer"&gt;forwardRef&lt;/a&gt;:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6bgjjb1e6dymi7rvpp4.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6bgjjb1e6dymi7rvpp4.png" alt="Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Here comes the important part to call the child method.
&lt;/h1&gt;

&lt;p&gt;Now we will just render the child component in the parent and create a ref using &lt;a href="https://reactjs.org/docs/hooks-reference.html#useref" rel="noopener noreferrer"&gt;React.useRef&lt;/a&gt; with that the getAlert() function will be called.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;forwardRef&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useImperativeHandle&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// We need to wrap component in `forwardRef` in order to gain&lt;/span&gt;
&lt;span class="c1"&gt;// access to the ref object that is assigned using the `ref` prop.&lt;/span&gt;
&lt;span class="c1"&gt;// This ref is passed as the second parameter to the function component.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;forwardRef&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getAlert&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;getAlert from Child&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="c1"&gt;// The component instance will be extended&lt;/span&gt;
  &lt;span class="c1"&gt;// with whatever you return from the callback passed&lt;/span&gt;
  &lt;span class="c1"&gt;// as the second argument&lt;/span&gt;
  &lt;span class="nf"&gt;useImperativeHandle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="nx"&gt;getAlert&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}));&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Count&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getAlert&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Click&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;br&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Parent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// In order to gain access to the child component instance,&lt;/span&gt;
  &lt;span class="c1"&gt;// you need to assign it to a `ref`, so we call `useRef()` to get one&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;childRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Child&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;childRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;childRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAlert&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Click&lt;/span&gt; &lt;span class="nx"&gt;Parent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Child component is rendered and a ref is created using &lt;a href="https://reactjs.org/docs/hooks-reference.html#useref" rel="noopener noreferrer"&gt;React.useRef&lt;/a&gt; named childRef. The button we created in parent component is now used to call the child component function childRef.current.getAlert();&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqj4fhltc07zz7aylye6.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqj4fhltc07zz7aylye6.png" alt="Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Reference
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;https://reactjs.org/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackoverflow.com/" rel="noopener noreferrer"&gt;https://stackoverflow.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>functional</category>
    </item>
  </channel>
</rss>
