<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":4009,"date":"2022-03-28T05:39:45","date_gmt":"2022-03-28T05:39:45","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4009"},"modified":"2022-05-04T05:47:10","modified_gmt":"2022-05-04T05:47:10","slug":"what-is-prop-drilling","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/","title":{"rendered":"What is Prop Drilling ?"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4269 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png\" alt=\"\" width=\"923\" height=\"745\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png 923w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling-300x242.png 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling-768x620.png 768w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling-390x315.png 390w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling-820x662.png 820w\" sizes=\"(max-width: 923px) 100vw, 923px\" \/><\/p>\n<ul>\n<li style=\"text-align: justify;\">We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.<\/li>\n<li style=\"text-align: justify;\">Prop drilling is basically a situation when the same data is being sent at almost every level due to requirements in the final level.<\/li>\n<li style=\"text-align: justify;\">We refer prop drilling to the process of sending props from a higher-level component to a lower-level component.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-4023 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/what-is-prop-drilling-in-react-1.png\" alt=\"\" width=\"618\" height=\"380\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/what-is-prop-drilling-in-react-1.png 618w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/what-is-prop-drilling-in-react-1-300x184.png 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/what-is-prop-drilling-in-react-1-390x240.png 390w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-4270\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/react-props.gif\" alt=\"\" width=\"1268\" height=\"647\" \/><\/p>\n<p><strong>For example,<\/strong><\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markup code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markup code-embed-code\">  import React, { useState } from &quot;react&quot;;<br\/>  <br\/>function Parent() {<br\/>  const [fName, setfName] = useState(&quot;firstName&quot;);<br\/>  const [lName, setlName] = useState(&quot;LastName&quot;);<br\/>  return (<br\/>    &lt;&gt;<br\/>      &lt;div&gt;This is a Parent component&lt;\/div&gt;<br\/>      &lt;br \/&gt;<br\/>      &lt;ChildA fName={fName} lName={lName} \/&gt;<br\/>    &lt;\/&gt;<br\/>  );<br\/>}<br\/>  <br\/>function ChildA({ fName, lName }) {<br\/>  return (<br\/>    &lt;&gt;<br\/>      This is ChildA Component.<br\/>      &lt;br \/&gt;<br\/>      &lt;ChildB fName={fName} lName={lName} \/&gt;<br\/>    &lt;\/&gt;<br\/>  );<br\/>}<br\/>  <br\/>function ChildB({ fName, lName }) {<br\/>  return (<br\/>    &lt;&gt;<br\/>      This is ChildB Component.<br\/>      &lt;br \/&gt;<br\/>      &lt;ChildC fName={fName} lName={lName} \/&gt;<br\/>    &lt;\/&gt;<br\/>  );<br\/>}<br\/>  <br\/>function ChildC({ fName, lName }) {<br\/>  return (<br\/>    &lt;&gt;<br\/>      This is ChildC component.<br\/>      &lt;br \/&gt;<br\/>      &lt;h3&gt; Data from Parent component is as follows:&lt;\/h3&gt;<br\/>      &lt;h4&gt;{fName}&lt;\/h4&gt;<br\/>      &lt;h4&gt;{lName}&lt;\/h4&gt;<br\/>    &lt;\/&gt;<br\/>  );<br\/>}<br\/>  <br\/>export default Parent;<\/code><\/pre> <\/div>\n<p>&nbsp;<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4025 size-full\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/output-for-prop-drilling-1.png\" alt=\"\" width=\"876\" height=\"692\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/output-for-prop-drilling-1.png 876w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/output-for-prop-drilling-1-300x237.png 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/output-for-prop-drilling-1-768x607.png 768w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/output-for-prop-drilling-1-390x308.png 390w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/output-for-prop-drilling-1-820x648.png 820w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling. Prop drilling is basically a situation when the same data is being sent at almost every level due to requirements in the final level. We refer prop drilling to the process [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[16542],"tags":[16790,16804,16795,16791,16800,16798,16796,16797,16794,16792,16803,16789,16802,16793,16801,16799],"class_list":["post-4009","post","type-post","status-publish","format-standard","hentry","category-reactjs","tag-avoid-prop-drilling-with-react-context","tag-how-to-avoid-prop-drilling","tag-how-to-avoid-prop-drilling-in-react","tag-prop-drilling","tag-prop-drilling-is-good","tag-prop-drilling-react-hooks","tag-prop-drilling-vs-context","tag-react-prop-drilling-example","tag-react-prop-drilling","tag-the-upsides-of-prop-drilling-in-react","tag-what-is-prop-drilling-and-how-can-you-avoid-it","tag-what-is-prop-drilling-and-how-to-avoid-it","tag-what-is-prop-drilling-in-react","tag-what-is-react-prop-drilling","tag-what-problem-does-context-api-solve","tag-why-is-prop-drilling-bad"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Prop Drilling ? - ReactJs Interview Questions and Answers<\/title>\n<meta name=\"description\" content=\"What is Prop Drilling ? - We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Prop Drilling ? - ReactJs Interview Questions and Answers\" \/>\n<meta property=\"og:description\" content=\"What is Prop Drilling ? - We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-28T05:39:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-04T05:47:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png\" \/>\n<meta name=\"author\" content=\"webmaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webmaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/\",\"name\":\"What is Prop Drilling ? - ReactJs Interview Questions and Answers\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png\",\"datePublished\":\"2022-03-28T05:39:45+00:00\",\"dateModified\":\"2022-05-04T05:47:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What is Prop Drilling ? - We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/#primaryimage\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png\",\"contentUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png\",\"width\":923,\"height\":745},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\",\"name\":\"webmaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"caption\":\"webmaster\"},\"sameAs\":[\"https:\/\/www.wikitechy.com\/interview-questions\"],\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Prop Drilling ? - ReactJs Interview Questions and Answers","description":"What is Prop Drilling ? - We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/","og_locale":"en_US","og_type":"article","og_title":"What is Prop Drilling ? - ReactJs Interview Questions and Answers","og_description":"What is Prop Drilling ? - We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/","og_site_name":"Wikitechy","article_published_time":"2022-03-28T05:39:45+00:00","article_modified_time":"2022-05-04T05:47:10+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png"}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/","name":"What is Prop Drilling ? - ReactJs Interview Questions and Answers","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png","datePublished":"2022-03-28T05:39:45+00:00","dateModified":"2022-05-04T05:47:10+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What is Prop Drilling ? - We pass a prop with another component with the help of all the components that come between, this method is known as prop drilling.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-prop-drilling\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/03\/props-drilling.png","width":923,"height":745},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4","name":"webmaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","caption":"webmaster"},"sameAs":["https:\/\/www.wikitechy.com\/interview-questions"],"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=4009"}],"version-history":[{"count":4,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4009\/revisions"}],"predecessor-version":[{"id":4271,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4009\/revisions\/4271"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}