this.setState is undefined

前端 未结 8 2108
无人及你
无人及你 2020-12-09 01:24

I keep seeing answers that say to use => or .bind(this) but neither of those solutions worked.

import React, { Component } from \'react\';
import { View, Tex         


        
8条回答
  •  感动是毒
    2020-12-09 02:15

    works for react-native too when you use fat arrow functions inside the methods you are invoking another function. eg .then((response) => { this.setState({....}) }

提交回复
热议问题