[react] 动态JSX标签
- 原本的写法
const input = this.props.long ? <textarea
  onChange={this.props.onChange}
  className="make-this-pretty"
  id="important-input"
  name="important-input"
/> : <input
  onChange={this.props.onChange} 
  className="make-this-pretty"
  id="important-input"
  name="important-input"
/>;
- 改进的写法
const Tag = this.props.long ? "textarea" : "input";
const input = <Tag 
                  onChange={this.props.onChange}
                  className="make-this-pretty"
                  id="important-input"
              />;
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号