.map() , Undefined is not a function in React Native

Viewed 9021

So I make a call to a API and use it to setState.

My state:

  state = {
   candlesticks: []
};

My API call and promise function:

componentDidMount() {
    axios
      .get(
    "apiurl"
      )
      .then(data => {
        let mappedData = data.map((record) => {record.date *= 1000}); //getting the error here with the map()function
        this.setState({
          candlesticks: mappedData
        });
      });
  }

I've tried different variations on the code but it still gives this error. I'm using Expo framework.

undefined is not a function (evaluating 'data.map(function (record){record.date *= 1000})')

1 Answers
Related