|
1 | | -// Copyright 2018 Workiva Inc. |
| 1 | +// Copyright 2025 Workiva Inc. |
2 | 2 | // |
3 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | 4 | // you may not use this file except in compliance with the License. |
|
25 | 25 | /// import 'package:over_react/over_react.dart'; |
26 | 26 | library over_react.react_dom; |
27 | 27 |
|
28 | | -import 'dart:html'; |
29 | | - |
30 | | -import 'package:over_react/over_react.dart'; |
31 | | -import 'package:react/react_dom.dart' as react_dom show render, unmountComponentAtNode; |
32 | | - |
33 | | -/// Renders the provided [element] into the DOM mounted in the provided [mountNode] |
34 | | -/// and returns a reference to it based on its type: |
35 | | -/// |
36 | | -/// 1. Returns an [Element] if [element] is a DOM component _(e.g. [Dom.div])_. |
37 | | -/// 2. Returns a React `Component` if [element] is a composite component. |
38 | | -/// |
39 | | -/// > __Throws__ if [element] or [mountNode] are `null`. |
40 | | -/// |
41 | | -/// If the [element] was previously rendered into the [mountNode], this will perform an update on it and only |
42 | | -/// mutate the DOM as necessary to reflect the latest React component. |
43 | | -/// |
44 | | -/// Use [unmountComponentAtNode] to unmount the instance. |
45 | | -/// |
46 | | -/// > Proxies [react_dom.render]. |
47 | | -dynamic render(ReactNode element, Element mountNode) { |
48 | | - return react_dom.render(element, mountNode); |
49 | | -} |
50 | | - |
51 | | -/// Removes a React `Component` from the DOM that was mounted via [render] |
52 | | -/// and cleans up its event handlers and state. |
53 | | -/// |
54 | | -/// * Returns `false` if a `Component` was not mounted in the [mountNode]. |
55 | | -/// * Returns `true` if a `Component` was mounted in the [mountNode]. |
56 | | -/// |
57 | | -/// > Proxies [react_dom.unmountComponentAtNode]. |
58 | | -bool unmountComponentAtNode(Element mountNode) { |
59 | | - return react_dom.unmountComponentAtNode(mountNode) as bool; |
60 | | -} |
| 28 | +export 'package:over_react/src/react_dom.dart' show render, unmountComponentAtNode; |
0 commit comments