Skip to content
pubscout

react

7.3.2, released 8 months ago by workiva.com

Dart wrapper for the ReactJS library to build interactive web interfaces.

$ flutter pub add react
Source repository

What it does

Provides bindings for ReactJS, allowing developers to create React components, manage state and lifecycle methods, and render elements using Dart for web applications.

AI-written summary of version 7.3.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building web applications in Dart and prefer React's component model over Flutter Web
  • You need to integrate with existing ReactJS libraries or projects

Skip it when

  • You are building standard Flutter mobile or desktop applications
  • You want to use modern Flutter widget trees and Material components

Strengths

  • Enables ReactJS usage with Dart
  • Supports React 17 and React 18
  • Includes unit testing utilities wrapping React TestUtils

Weaknesses

  • Requires manual HTML setup and JavaScript file management
  • Typed interfaces can be verbose
  • Deprecated APIs in older versions require migration

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
2

Requires adding JavaScript files for React and ReactDOM to your HTML file, along with the generated Dart JS output script.

import 'dart:html';
import 'package:react/react.dart';
import 'package:react/react_dom.dart' as react_dom;

main() {
  var component = div({}, "Hello world!");
  react_dom.render(component, querySelector('#react_mount_point'));
}

Alternatives

Packages that do the same job and could replace react.

  • yaru

    Flutter widgets and theme following the Yaru design language for desktop and web.

Works with

Packages commonly used together with react: ones it builds on, ones built on it, and its own family.