Skip to content

Commit 860f022

Browse files
committed
Added React.Children.toArray
1 parent 805ce01 commit 860f022

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
@@ -102,6 +102,9 @@ trait ReactChildren extends Object {
102102

103103
/** 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. */
104104
def count(c: PropsChildren): Int = js.native
105+
106+
/** 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. */
107+
def toArray(c: PropsChildren): js.Array[ReactNode] = js.native
105108
}
106109

107110
trait ReactComponentSpec[Props, State, +Backend, +Node <: TopNode] extends Object with ReactComponentTypeAuxJ[Props, State, Backend, Node]

0 commit comments

Comments
 (0)