Answer the question
In order to leave comments, you need to log in
How to change the react native state outside the component?
Good day. There is a component, when clicked, a simple request to the server occurs.
Something like this
(React native, redux)
class MasterScreen extends Component {
render() {
return (<Button title={getPhrase('checkin')} onPress={() => this.onClick()} />);
}
....
onClick() {
if(this.validate()) {
sendRequest(this.data).then(result => {
this.props.someAction(this.data.id); // тут меняется state (redux)
.....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question