Skip to content

Commit 39d3926

Browse files
committed
Merge pull request #211 from zlangbert/children-toarray
Added React.Children.toArray
2 parents f988eb5 + 860f022 commit 39d3926

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/scala/japgolly/scalajs/react/React.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,7 @@ trait ReactChildren extends Object {
130130

131131
/** Return the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked. */
132132
def count(c: PropsChildren): Int = js.native
133+
134+
/** 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. */
135+
def toArray(c: PropsChildren): js.Array[ReactNode] = js.native
133136
}

0 commit comments

Comments
 (0)