如何在ReactJS中有条件地加载组件

编程入门 行业动态 更新时间:2024-10-09 14:19:49
本文介绍了如何在ReactJS中有条件地加载组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是来自ReactJS的新入门者。无法获得容易掌握的资源促使我再次敲响SO。问题是这个。我有一个React组件,即 RegisterAccount ,当点击时会拍摄另一个组件(弹出窗口),允许用户填写注册帐户所需的详细信息。现在,一旦帐户成功注册,我想将注册帐户添加为 RegisterAccount 下的另一个组件。如何设置此通讯?

This is from a new starter of ReactJS. Unavailability of easily graspable resources has prompted me to knock at SO again. The issue is this. I have a React Component namely, RegisterAccount which when clicked shoots another component (a pop-up) allowing users to fill in the required details to register an account. Now once an account is successfully registered, I want to add the registered account as another component under RegisterAccount. How can I have this communication set up?

//In RegisterAccount <addAccount/> //pop-up <accountAdded/> //if account added, then show this component

推荐答案

我是React的新手。我也在寻找如何。我看到了这个文章! 如下所示

I'm new to React. I was also finding how. and I saw this article! It says like belows

render : function() { return ( <div> { true && <AddAccount /> } { false && <AccountAdded /> } </div> ); }

更多推荐

如何在ReactJS中有条件地加载组件

本文发布于:2023-11-23 00:44:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619511.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中有   组件   加载   条件   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!