我在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;
答案 0 :(得分:0)
您可以使用&gt; >
和<
和&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>