CallbackRef typedef

CallbackRef = dynamic Function(dynamic ref)

A function that, when supplied as ReactPropsMixin.ref, is called with the component instance as soon as it is mounted.

This instance can be used to retrieve a component's DOM node or to call a component's public API methods.

The component instance will be of the type:

  • react.Component2 for Dart components
  • ReactComponent for JS composite components
  • Element for DOM components

Example:

FooComponent _fooRef;

render() {
  return (Foo()
    ..ref = (ref) { _fooRef = ref; }
  )();
}

barTheFoo() => _fooRef.bar();

getFooNode() => findDomNode(_fooRef);

See: facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute.

Implementation

typedef CallbackRef(ref);