是否有一个等效ng-show,并ng-hide在react.js?
<input type="checkbox" ng-model="myVar">
<div ng-show="myVar">
<h1>Welcome</h1>
<p>Welcome to my home.</p>
</div>
Run Code Online (Sandbox Code Playgroud)
在Angular中,上面的代码工作得非常好,但我正在尝试使用反应,我无法找到相应的....
我正在加注发票页面,用户可以在点击按钮时提出发票,我会拨打api电话,在收到回复后我想将一些数据发送到页面(RaisedInvoice.jsx),这应该是在新标签中打开,我该怎么做.我没有得到的是如何在单击ReactJs中的按钮时在新选项卡中打开页面.
RaiseInvoice.jsx:
import React from 'react';
import Links from './Links.jsx';
import history from './history.jsx';
import axios from 'axios';
class RaiseInvoice extends React.Component {
constructor(props) {
super(props);
// This binding is necessary to make `this` work in the callback
this.state = {projects: [], searchParam : ''};
this.raiseInvoiceClicked = this.raiseInvoiceClicked.bind(this);
}
raiseInvoiceClicked(){
// here i wish to write the code for opening the page in new tab.
}
render() {
return (
<div>
<Links activeTabName="tab2"></Links>
<div …Run Code Online (Sandbox Code Playgroud) 实际上,我试图在react 中隐藏和显示一些 html 元素。我创建了一个员工表单,其中我们有多个分区,例如个人信息、联系信息等...我在表单中创建了下一个和上一个按钮以显示和隐藏表单中的其他分区有一个分区,其中我们有教育要填写的详细信息,因此我选择保留加号和减号按钮以使用条件添加教育详细信息。
But finally, my problem is like i have complex conditions on **render** function:
{someCondition && <div>
{anotherCondition && <div></div>}
</div>}
But, i'm getting: *Adjacent JSX elements must be wrapped in an enclosing tag error*. So, what i'm supposed to do?
Run Code Online (Sandbox Code Playgroud)