From 5b8607aded1e4139db092fe6f83bab9b547a975b Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Sun, 30 Apr 2017 18:04:19 +0900 Subject: [PATCH] Put keys in virtual-nodes.md, re-order TOC. --- docs/README.md | 51 ++-------------------------------- docs/keys.md | 31 --------------------- docs/{router.md => routing.md} | 2 +- docs/virtual-nodes.md | 33 +++++++++++++++++++++- 4 files changed, 35 insertions(+), 82 deletions(-) delete mode 100644 docs/keys.md rename docs/{router.md => routing.md} (99%) diff --git a/docs/README.md b/docs/README.md index b9732056e..257c7e8c6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,67 +3,20 @@ * [Getting Started](/docs/getting-started.md) * [Hyperx](/docs/hyperx.md) * [JSX](/docs/jsx.md) -* [Virtual Nodes](/docs/virtual-nodes.md) -* [Custom Tags](/docs/custom-tags.md) -* [Keys](/docs/keys.md) * [Applications](/docs/applications.md) - * [View and State](/docs/applications.md#view-and-state) - * [Actions](/docs/applications.md#actions) - * [Events](/docs/applications.md#events) - * [Plugins](/docs/applications.md#plugins) * [Lifecycle Events](/docs/lifecycle-events.md) -* [Router](/docs/router.md) -* [Tutorials](/docs/tutorials.md) - * [Counter](/docs/counter.md) - * [Countdown Timer](/docs/countdown-timer.md) - * [Gif Search](/docs/gif-search.md) -* [API](/docs/api.md) - - - diff --git a/docs/keys.md b/docs/keys.md deleted file mode 100644 index 81b32fd7c..000000000 --- a/docs/keys.md +++ /dev/null @@ -1,31 +0,0 @@ -# Keys - -Every time your application is rendered, a virtual node tree is created from scratch. - -Keys help identify which nodes were added, changed or removed from the new/old tree. - -Use keys to tell the render algorithm to re-order the children instead of mutating them. - -```jsx - -``` - -For example, use keys to force an element to be created only once. - -```jsx - -``` - -If new elements added to the list, the position of the keyed element will change. Using a key in this way, makes sure Hyper is always inserted in the right position instead of mutating its siblings. - - diff --git a/docs/router.md b/docs/routing.md similarity index 99% rename from docs/router.md rename to docs/routing.md index f43e9cf09..93c7bf44e 100644 --- a/docs/router.md +++ b/docs/routing.md @@ -1,4 +1,4 @@ -# Router +# Routing To add routing to your application, use the Router plugin. diff --git a/docs/virtual-nodes.md b/docs/virtual-nodes.md index e5afbf87d..43aa0e890 100644 --- a/docs/virtual-nodes.md +++ b/docs/virtual-nodes.md @@ -68,5 +68,36 @@ data: { } ``` -Attributes also include [lifecycle events](/docs/lifecycle-events.md) and meta data such as [keys](/docs/keys.md). +Attributes also include [lifecycle events](/docs/lifecycle-events.md) and meta data such as [keys](#keys). + +## Keys + +Every time your application is rendered, a virtual node tree is created from scratch. + +Keys help identify which nodes were added, changed or removed from the new/old tree. + +Use keys to tell the render algorithm to re-order the children instead of mutating them. + +```jsx + +``` + +For example, use keys to force an element to be created only once. + +```jsx + +``` + +If new elements are added to the list, the position of the keyed element will change. Using a key in this way, we make sure Hyper is always inserted in the right position instead of mutating its siblings. +