\*\*In this my code, I got an error which says 'this.state.leader.map' is not a function.

I searched on web about my problem but none of them solved my issue.

This is my code which is below. I hope, code is clear to understand easly\*\*

```
import React, { Component } from 'react';
import { View, Text, FlatList } from 'react-native';
import DOMParser from 'react-native-html-parser';
import axios from 'axios';

export default class header extends Component {

    state = { leader: [] };

    componentWillMount() {
        fetch('url')
        .then(response => {
            if (response.ok) {
                return response;
            }else {
                let error = new Error('Error ');
                error.response = response;
                throw error;
            }
            },
            error => {
                let errmess = new Error(error.message);
                throw errmess;
            })
        .then(response => response.text())
        .then(leaders => {
            const str = leaders.substring(76);
            const str2 = str.substring(0, str.length - 9);

            this.setState({ leader: str2 });
        })
        .catch(error => {
            this.setState({ errMessage: error.message });
        });
        }

        renderall() {
            return this.state.leader.map(alb => <Text>{alb.Ref}</Text>  
        }

    render() {

        console.log(this.state.leader);

        return (
            <View>
              {this.renderall()}
            </View>
        );
    }
}

```