0

これが私のインスタンスです。ログイン div を取得し、refs を使用して非表示にする必要があります。これを達成するにはどうすればよいですか?

var Text=React.createClass({
componentDidMount:function(){
  console.log(this.refs.login.getDOMNode());

}, 

render:function(){
return (<View ref="login">
          <Text>Abc</Text>
          <Text>123</Text>
        </View>)
}
})`
4

1 に答える 1

0

次のようなことができます。

render: function() {
    if(this.props.show) {
        return (<View ref="login">
              <Text>Abc</Text>
              <Text>123</Text>
            </View>)
    } else {
        return null;
    }
}
于 2015-08-03T12:46:18.603 に答える