Question: I stored an array in a .js file as i was going to use it in number of other files. Though i got it correctly in other files (checked by rendering the items of the array) but i am not able to mutate the array as i need to add and remove items from the array.

Here is the file where my array is present;

```
export default myArray = ['first thing', 'second thing', 'and so on'];

```

And this is what i tried;

First i imported it;

```
import myArray from 'path/of/the/file.js'

```

Then tried to mutate it;

```
myArray = [...myArray , andSomeOtherItem];

```

This shows an error;

```
myArray is read-only

```

After searching about it, i think that this is a default behavior of react-native. If i am right, then how can i achieve that?

Answer: 
You should be using the ViewChild template reference in your ts file.First add the template reference to the "apex-chart" component.I have add "#chart" to the apex-chart component.

**html**

```
<apx-chart #chart [chart]="{
                          type: 'line',
                          height: 20,
                          background: '#696868',
                          sparkline: {
                              enabled: true
                          }
                      }" [colors]="['#f2f2f2']" [markers]="{
                          size: 0
                      }" [series]="chartOptions.series" [stroke]="{
                              color: '#4191ff',
                              width: 1
                      }" [xaxis]="{
                          crosshairs: {
                              width: 0
                          }
                      }" [yaxis]="{
                          min: 0
                      }" ></apx-chart></code>

```

Now use the template reference in your typescript file to update your series data like this

```
this.chart.updateSeries([
      {
        name: 'series_1',
      data: randomArray
      }
    ])

```
The major thing to do is access your apex chart in the components using template variable syntax #whateverYourChartName then updateOptions or updateSeries like this
[Link to Apex docs](https://apexcharts.com/docs/methods/#updateOptions)