build method

  1. @override
ReactElement build(
  1. Map props, [
  2. List<ReactNode?> childrenArgs = const []
])
override

Returns a new rendered component instance with the specified props and childrenArgs.

Necessary to work around DDC dart.dcall issues in github.com/dart-lang/sdk/issues/29904, since invoking the function directly doesn't work.

Implementation

@override
ReactElement build(Map props, [List<ReactNode> childrenArgs = const []]) {
  var children = generateChildren(childrenArgs);

  if (isConsumer) {
    if (children is Function) {
      final contextCallback = children;
      children = allowInterop((args) {
        return contextCallback(ContextHelpers.unjsifyNewContext(args));
      });
    }
  }

  return React.createElement(type, generateExtendedJsProps(props), children);
}