functionalComponent

ReactElement functionalComponent(

  1. String name,
  2. ReactElement render(
    1. JSObject props
    )
)

Create a React element with an inline functional component.

Example:

final element = functionalComponent('Counter', (props) {
  final count = useState(0);
  return div(children: [pEl('Count: ${count.value}')]);
});

Implementation

ReactElement functionalComponent(
  String name,
  ReactElement Function(JSObject props) render,
) => createElement(createFunctionalComponent(render));