From 7aecf554052755c41aa2a4ec7d36b443a5b81545 Mon Sep 17 00:00:00 2001 From: Jess Telford Date: Tue, 16 Aug 2016 16:43:33 +1000 Subject: [PATCH] React.Children.toArray() changes keys (#7495) As noted by @spicyj in #5541 --- docs/ref-01-top-level-api.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/ref-01-top-level-api.md b/docs/ref-01-top-level-api.md index c4e9b15d..bb22b2bd 100644 --- a/docs/ref-01-top-level-api.md +++ b/docs/ref-01-top-level-api.md @@ -132,6 +132,10 @@ array React.Children.toArray(object children) Return the `children` opaque data structure as a flat array with keys assigned to each child. Useful if you want to manipulate collections of children in your render methods, especially if you want to reorder or slice `this.props.children` before passing it down. +> Note: +> +> `React.Children.toArray()` changes keys to preserve the semantics of nested arrays when flattening lists of children. That is, `toArray` prefixes each key in the returned array so that each element's key is scoped to the input array containing it. + ## ReactDOM The `react-dom` package provides DOM-specific methods that can be used at the top level of your app and as an escape hatch to get outside of the React model if you need to. Most of your components should not need to use this module.