Q: How to add the data to data source rather than replace? I am working on a react native app, where on receiving the data from fetch request I need to show it in a list view, I receive the data on each fetch that I want to add to previously received data , but my code below just replaces it , I am new to react native and to JavaScript in general so kindly explain how to achieve it 
fetch("http://example.com/getDataFromIndex.php", {
        method: 'POST',
        headers: new Headers({
            'Content-Type': 'application/x-www-form-urlencoded', // <-- Specifying the Content-Type
        }),
        body: params // <-- Post parameters
    }).then((response) => response.json())
        .then((responseJson) => {

            this.setState({
                isLoading: false,
                dataSource: responseJson.data,
            }, function(){

            });

        })
        .catch((error) =>{
            console.error(error);
        });

I want to append data to dataSource rather than just replace old one.

A: Assuming dataSource and responseJson.data are both arrays, you can concat them.
this.setState({
  isLoading: false,
  dataSource: Object.assign(this.state.dataSource).concat(responseJson.data)
});


A: You should use newer ECMAScript 6's object rest spread like this:           
this.setState({
                isLoading: false,
                dataSource: {...this.state.dataSoure, ...responseJson.data}
            }, function(){
            // do something after `setState` has occurred (asynchronously)
        })

