{this.props.redirectTo?<Redirect to={this.props.redirectTo} />:null} 为什么要写在return里
来源:6-10 登录注册-注册跳转+密码加密实现

Oops___
2018-01-04
{this.props.redirectTo?<Redirect to={this.props.redirectTo} />:null}
请问老师 这句代码为什么是这样写
render() { return ( <div> {this.props.redirectTo?<Redirect to={this.props.redirectTo} />:null} <Logo></Logo> <h2>注册页面</h2> <WingBlank> <List> ......
但是以下这样写就没有效果呢?
render() { this.props.redirectTo?<Redirect to={this.props.redirectTo} />:null return ( <div> <Logo></Logo> <h2>注册页面</h2> <WingBlank> <List> ......
写回答
1回答
-
慕瓜8449030
2018-01-04
你好 因为这里面是涉及到js的语法 所以要放在花括号里面
022018-02-13
Redux+React Router+Node.js全栈开发
全网唯一的React 16+Redux+React Router4实战课程,学到手是你的真本领!
1822 学习 · 750 问题
相似问题