Reputation: 6232
I'm trying to get a <Text>
component in the view and edit its value in runtime.
What I tried:
<Text ref="SignInMessage">qqq</Text>
Then to get and change the text I do this.refs.SignInMessage.props.children = err.message
but it doesn't change.
I also tried:
<Text>{this.SignInMessage}</Text>
And then this.SignInMessage = err.message;
but it also doesn't change.
Upvotes: 0
Views: 61
Reputation: 2668
You can use state to update the value
this.state({ SignInMessage: '' }); // initialize
this.setState({ SignInMessage: 'bl bla'}); // update
<Text>{this.state.SignInMessage}</Text>
Upvotes: 2