Why is my react component not updating with state updates?

前端 未结 2 1879
无人及你
无人及你 2021-02-19 18:51

I have a map app I built that requires some map icons to appear/disappear after a button press, but I can\'t figure out how to set it to re-render the component when I pass in a

2条回答
  •  甜味超标
    2021-02-19 19:17

    .then((response) => {
        this.setState({events: resp});
    }
    

    You take in parameter response then try to use resp which isnt the variable you want.

提交回复
热议问题