0

here is my instance I need to get the login div and hide it using refs How to achieve this ?

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>)
}
})`
Vikram Jakkampudi
  • 502
  • 1
  • 3
  • 16

1 Answers1

0

You could do something like this:

render: function() {
    if(this.props.show) {
        return (<View ref="login">
              <Text>Abc</Text>
              <Text>123</Text>
            </View>)
    } else {
        return null;
    }
}
Colin Ramsay
  • 16,086
  • 9
  • 52
  • 57