Home > Software design >  undefined is not a function (near '...this.state.dataBanner.map...')
undefined is not a function (near '...this.state.dataBanner.map...')

Time:01-26

I have already checked some similar questions with the same problem: enter image description here

CodePudding user response:

You can try

        this.setState({
            dataNews:responseJson?.articles, // add articals here
            dataBanner:responseJson?.articles // add articals here
        })
   

and also you can validate

<Swiper>
    {this.state.dataBanner?.length > 0 && this.state.dataBanner.map((itemImg) => {
        return (
            <Image
                source={{ uri: itemImg.urlToImage }}
                style={{ height: "100%", width: "100%" }}
            />
        )
    })}
</Swiper>



 
  •  Tags:  
  • Related