zoukankan      html  css  js  c++  java
  • [React] React Fundamentals: JSX Deep Dive

    "JSX transforms from an XML-like syntax into native JavaScript. XML elements and attributes are transformed into function calls and objects, respectively."

    Input:

    React.createClass({
      render: function(){
       var style = {
          backgroundColor: '#ccc',
          color: blue
       };
        return (
             <div >
                  <a href="#"  style={style}/> {/*This is comment*/} Thisis message
                  {/*JSX don't have if else*/}
                  {i > 1 ? 'More than one' : 'one'}
                  {i>1&& 'More than one' }
            </div>
        )
     }
    })

    output:

    React.createClass({
      render: function(){
       var style = {
          backgroundColor: '#ccc',
          color: blue
       };
        return (
             React.createElement("div", null, 
                  React.createElement("a", {href: "#", style: style}), " ", /*This is comment*/" Thisis message", 
                  /*JSX don't have if else*/
                  i > 1 ? 'More than one' : 'one', 
                  i>1&& 'More than one'
            )
        )
     }
    })
  • 相关阅读:
    DEBUG 知识
    转载:telnet启动后的登录问题
    通过ip找主机名
    转载:网线的相关知识
    hdu2717(广度优先搜索)
    hdu1241(bfs)
    hdu1060 数论
    大数除(hdu2117)
    hdu1159(DP)
    hdu2181__DFS
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4761438.html
Copyright © 2011-2022 走看看