react_client/react_interop library

JS interop classes for main React JS APIs and react-dart internals.

For use in react_client.dart and by advanced react-dart users.

Classes

InteropProps
A JavaScript interop class representing a React JS props object.
JsRef
A JS ref object returned by React.createRef.
PropTypes
Runtime type checking for React props and similar objects.
React
ReactClass
A React class specification returned by React.createClass.
ReactClassConfig
A JS interop class used as an argument to React.createClass.
ReactComponent
The JavaScript component instance, which backs each react-dart Component.
ReactContext
A JavaScript interop class representing the return value of createContext.
ReactDartComponentInternal
Deprecated.
ReactDartComponentVersion
Constants for use with ReactClass.dartComponentVersion to distinguish different versions of Dart component implementations / base classes.
ReactDom
ReactDomServer
ReactElement
A virtual DOM element representing an instance of a DOM element, React component, or fragment.
ReactErrorInfo
Information on an error caught by componentDidCatch.
ReactPortal
A virtual DOM node representing a React Portal, returned by ReactDom.createPortal.
Ref<T>
When this is provided as the ref prop, a reference to the rendered component will be available via current.

Properties

inReactDevMode bool
Whether the "dev" build of react.js is being used.
no setter
jsNull → dynamic
A JS variable that can be used with Dart interop in order to force returning a JavaScript null. Use this if dart2js is possibly converting Dart null into undefined.
no setter
jsUndefined → dynamic
A JS variable that can be used with Dart interop in order to force returning a JavaScript undefined. Use this if dart2js is possibly converting Dart undefined into null.
no setter

Functions

createRef<T>() Ref<T?>
Creates a Ref object that can be attached to a ReactElement via the ref prop.
forwardRef2(DartForwardRefFunctionComponent wrapperFunction, {String? displayName}) ReactComponentFactoryProxy
Automatically passes a Ref through a component to one of its children.
memo2(ReactComponentFactoryProxy factory, {bool areEqual(Map prevProps, Map nextProps)?}) ReactComponentFactoryProxy
A higher order component for function components that behaves similar to the way React.PureComponent does for class-based components.
throwErrorFromJS(dynamic error) → Never
Throws the error passed to it from Javascript. This allows us to catch the error in dart which re-dartifies the js errors/exceptions.

Typedefs

ReactJsComponentFactory = ReactElement Function(dynamic props, dynamic children)