Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.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
Javascript 如何将当前页面的道具传递到子页面_Javascript_Reactjs - Fatal编程技术网

Javascript 如何将当前页面的道具传递到子页面

Javascript 如何将当前页面的道具传递到子页面,javascript,reactjs,Javascript,Reactjs,这是Clients\u info.js 在这个组件的道具中,它有几个值 现在我想把这个组件中的所有道具传递给Modalbox组件 我知道如何将当前状态的值作为道具传递给渲染函数中的子组件。但是…从props到props 我怎么能做到呢?谢谢 从“React”导入React; 从“./Client\u modal”导入Modalbox 需要('../css/Clients.scss'); var$=require('jquery'); 导出默认类客户端\u信息扩展React.Component{

这是
Clients\u info.js

在这个组件的道具中,它有几个值

现在我想把这个组件中的所有
道具
传递给
Modalbox
组件

我知道如何将当前
状态的值作为
道具
传递给渲染函数中的子组件。但是…从
props
props

我怎么能做到呢?谢谢

从“React”导入React;
从“./Client\u modal”导入Modalbox
需要('../css/Clients.scss');
var$=require('jquery');
导出默认类客户端\u信息扩展React.Component{
建造师(道具){
超级(道具);
}
//在初始渲染发生之前,在客户端和服务器上调用一次。
组件willmount(){
}
render(){
返回(
{this.props.client.name}

电子邮件:{this.props.client.email}

电话:{this.props.client.phone}

地址上的位置:{this.props.client.loc}

我的位置邮政编码:{this.props.client.Zip}

vpn_密钥{this.props.client.key} 宠物信息 {this.props.pets.map(函数(pet)){ 返回( 阿凡达 {pet.petName} {宠物品种} {pet.age} 额外资料:

) }) } ); } }


应该做这项工作

将状态作为道具传递,或者道具作为道具是相同的。谢谢您的回复!那么这是否意味着我可以像这样做呢!这就是你所需要的。
<Modalbox pets={ this.props.pets }/>