<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":3950,"date":"2022-03-21T09:49:20","date_gmt":"2022-03-21T09:49:20","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=3950"},"modified":"2022-03-21T09:49:20","modified_gmt":"2022-03-21T09:49:20","slug":"what-is-the-difference-between-element-and-component","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/","title":{"rendered":"What is the difference between element and component ?"},"content":{"rendered":"<table width=\"670\">\n<tbody>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p><strong>\u00a0<\/strong><strong>Element<\/strong><\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p><strong>Component<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"344\">It is an object describing what you would like to project on the screen in terms of the DOM nodes or other components.<\/td>\n<td width=\"326\">It is a function or class that accepts an input and returns a React element.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>It contains other elements in its props.<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>It can be a class with a render() method.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>It describes what we want to see on the screen<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>It is a template. A blueprint. A global definition.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>It is an immutable description object and you can not apply any methods on it<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>It has to keep references to its DOM nodes and to the instances of the child components.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>There is no any method used.<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>The lifecycle method is used for each element.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>They are immutable i,e once created cannot be changed.<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>The state in a component is mutable.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>React Hooks cannot be used with elements as elements are immutable.<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>React hooks can be used with both functional and class components<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>Elements are faster.<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>Components are slower.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>It is an object representation of a DOM node.<\/td>\n<td width=\"326\">&nbsp;<\/p>\n<p>It is an object representation of the DOM tree.<\/td>\n<\/tr>\n<tr>\n<td width=\"344\">&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>e.g,<br \/>\n&lt;button class=\u201dwhite\u201d&gt; &lt;\/button&gt;<\/p>\n<p>&nbsp;<\/td>\n<td width=\"326\">e.g,<\/p>\n<p>const LogIn = () =&gt; (<\/p>\n<p>&lt;div&gt;<\/p>\n<p>&lt;p&gt; Login &lt;\/p&gt;<\/p>\n<p>&lt;button&gt; Continue &lt;\/button&gt;<\/p>\n<p>&lt;button color = \u201corange\u201d&gt; Cancel &lt;\/button&gt;<\/p>\n<p>&lt;\/div&gt;<\/p>\n<p>);<\/p>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u00a0Element &nbsp; Component It is an object describing what you would like to project on the screen in terms of the DOM nodes or other components. It is a function or class that accepts an input and returns a React element. &nbsp; It contains other elements in its props. &nbsp; It can be a [&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":[16570,16567,16571,16572,16573,16569,16566,16568],"class_list":["post-3950","post","type-post","status-publish","format-standard","hentry","category-reactjs","tag-difference-between-element-and-compound-with-example","tag-difference-between-react-component-and-react-element","tag-element-and-component-in-react","tag-elements-and-components-meaning","tag-what-is-component-element-example","tag-what-is-the-difference-between-a-component-and-an-element-of-an-array","tag-what-is-the-difference-between-element-and-component","tag-what-is-the-difference-between-element-and-component-react"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is the difference between element and component ? - Wikitechy<\/title>\n<meta name=\"description\" content=\"What is the difference between element and component ? - It is an object describing what you would like to project on the screen in terms of the DOM nodes.\" \/>\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-the-difference-between-element-and-component\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is the difference between element and component ? - Wikitechy\" \/>\n<meta property=\"og:description\" content=\"What is the difference between element and component ? - It is an object describing what you would like to project on the screen in terms of the DOM nodes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-21T09:49:20+00:00\" \/>\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=\"1 minute\" \/>\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-the-difference-between-element-and-component\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/\",\"name\":\"What is the difference between element and component ? - Wikitechy\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"datePublished\":\"2022-03-21T09:49:20+00:00\",\"dateModified\":\"2022-03-21T09:49:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What is the difference between element and component ? - It is an object describing what you would like to project on the screen in terms of the DOM nodes.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/\"]}]},{\"@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 the difference between element and component ? - Wikitechy","description":"What is the difference between element and component ? - It is an object describing what you would like to project on the screen in terms of the DOM nodes.","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-the-difference-between-element-and-component\/","og_locale":"en_US","og_type":"article","og_title":"What is the difference between element and component ? - Wikitechy","og_description":"What is the difference between element and component ? - It is an object describing what you would like to project on the screen in terms of the DOM nodes.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/","og_site_name":"Wikitechy","article_published_time":"2022-03-21T09:49:20+00:00","author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/","name":"What is the difference between element and component ? - Wikitechy","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2022-03-21T09:49:20+00:00","dateModified":"2022-03-21T09:49:20+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What is the difference between element and component ? - It is an object describing what you would like to project on the screen in terms of the DOM nodes.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/reactjs\/what-is-the-difference-between-element-and-component\/"]}]},{"@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\/3950","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=3950"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/3950\/revisions"}],"predecessor-version":[{"id":3951,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/3950\/revisions\/3951"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=3950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=3950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=3950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}