Can I use jsx without React to inline HTML in script?

后端 未结 8 1692
既然无缘
既然无缘 2021-01-31 02:20

Can I use inline HTML in a script as below by using a library like jsx:




        
8条回答
  •  -上瘾入骨i
    2021-01-31 03:15

    JSX is not a string-based templating language; it compiles to actual JavaScript function calls. For example,

    Here are some children

    transpiles to

    React.createElement("div", {attr1: "something", attr2: "other"}, 
      "Here are some ", React.createElement("span", null, "children")
    )
    

提交回复
热议问题