Props

JSX is very convenient when your DOM elements or React components have props. Using XML is pretty easy to set attributes on elements:

  <img src="https://www.dev.education/images/logo.png" alt="DEV  
Education" />

The equivalent in JavaScript would be as follows:

  React.createElement("img", { 
src: "https://www.dev.education/images/logo.png",
alt: "DEV Education"
});

This is far less readable, and even with only a couple of attributes it is harder to read without a bit of reasoning.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.160.216