Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 我如何才能在a<;p>;标签?_Reactjs_React Props - Fatal编程技术网

Reactjs 我如何才能在a<;p>;标签?

Reactjs 我如何才能在a<;p>;标签?,reactjs,react-props,Reactjs,React Props,我有一个标签,作为孩子有一个react道具。 我的问题是,我想在这个道具中使用头部,所以我尝试了,但道具将其呈现为文本,如下所示: 大家好世界你好 如果有人能帮助我,我将非常感激 编辑: 示例: example.js 从“React”导入React; 导出默认类示例扩展了React.Component{ render(){ 返回( ) } } TextComponent.js 从“React”导入React; 导出默认类TextComponent扩展React.Component{ rende

我有一个
标签,作为孩子有一个react道具。
我的问题是,我想在这个道具中使用头部,所以我尝试了

,但道具将其呈现为文本,如下所示:
大家好
世界你好

如果有人能帮助我,我将非常感激

编辑:
示例:
example.js

从“React”导入React;
导出默认类示例扩展了React.Component{
render(){
返回(
)
}
}
TextComponent.js

从“React”导入React;
导出默认类TextComponent扩展React.Component{
render(){
const content=this.props.content;
返回(
{content}

) } }
您现在将其作为字符串传递。将其作为jsx传递,就可以了:

<TextComponent content={<React.Fragment>Hi everybody <br /> Hello world!</React.Fragment>} /> 


请提供可复制的example@romants是我的错,我忘了