如何使用<%= TagName%>在React-Redux组件中

时间:2017-08-04 11:26:28

标签: reactjs redux react-redux

我在json文件中有标签,我想从那里加载那个静态标签,因为我维护了标签的语言特定json文件。

在不接受像<%= TagName%>这样的标签的反应组件中这个..我怎么能这样做..提前谢谢

import React from 'react';

    const HomePage = () => {
      return (
        <div>
          <h1>React Slingshot</h1>
          Here i want to Show my Tag Name like <%=TagName%> how can i show here...
        </div>
      );
    };

    export default HomePage;

2 个答案:

答案 0 :(得分:0)

您可以使用&gt; &gt;&lt;和&lt; html中的编码字符。

答案 1 :(得分:0)

I would use ES6 template strings for it

at the beginning u will pass assign tagname like: const tagname = 'p' and then your render method would be something like:

    <div>
      <h1>React Slingshot</h1>
        Here i want to Show my Tag Name like { `<${tagname}>`} how can i show here...
    </div>