Accepted answer

You'll need to make sure that the key value remains a constant for the lifetime of the object instance. As you have it coded, the key value is based on the index into the Array. If you remove one element from the Array, the indexes are updated, and so would be the keys. And, as a result, an object's key would change, and React will appear to not properly apply the new array changes (even when the underlying array has changed).

You'll need to either use a unique value from each object instance as the key or create one artificially (just assign a unique number to each object).


Use unique key is in Data Objects as below.

data = [
    id: 0,
    contents: 'data 0',
    id: 3,
    contents: 'data 3',
    id: 4,
    contents: 'data 4',

var rows =, index) {
            return <Row key={} data={rowData} onRowDelete={this.props.onRowDelete.bind(null, index)} />;
          }, this);

React do not re-render the component has the same key as one before.

Related Query

More Query from same tag