Skip to content

Commit c259e30

Browse files
committed
Element: Expose forwardRef as export from wp.element
1 parent 480990a commit c259e30

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

element/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
createElement,
66
createContext,
77
createRef,
8+
forwardRef,
89
Component,
910
cloneElement,
1011
Children,
@@ -51,6 +52,19 @@ export { createElement };
5152
*/
5253
export { createRef };
5354

55+
/**
56+
* Component enhancer used to enable passing a ref to its wrapped component.
57+
* Pass a function argument which receives `props` and `ref` as its arguments,
58+
* returning an element using the forwarded ref. The return value is a new
59+
* component which forwards its ref.
60+
*
61+
* @param {Function} forwarder Function passed `props` and `ref`, expected to
62+
* return an element.
63+
*
64+
* @return {WPComponent} Enhanced component.
65+
*/
66+
export { forwardRef };
67+
5468
/**
5569
* Renders a given element into the target DOM node.
5670
*

0 commit comments

Comments
 (0)