Skip to content

Instantly share code, notes, and snippets.

@teimurjan
Created May 21, 2018 06:58
Show Gist options
  • Save teimurjan/0ad6f6662516a0a6ba7cc48fc819fd83 to your computer and use it in GitHub Desktop.
Save teimurjan/0ad6f6662516a0a6ba7cc48fc819fd83 to your computer and use it in GitHub Desktop.
blog-react-applications-optimization
// You have this 4 components
const elements = [
{ type: "div", key: 0, textContent: "Container #0" },
{ type: "div", key: 1, textContent: "Container #1" },
{ type: "div", key: 2, textContent: "Container #2" },
{ type: "div", key: 3, textContent: "Container #3" }
];
// Delete Container #1
const elements = [
{ type: "div", key: 0, textContent: "Container #0" },
// Components with text Container #2 and Container #3 has new indexes
{ type: "div", key: 1, textContent: "Container #2" },
{ type: "div", key: 2, textContent: "Container #3" }
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment