Skip to content

Commit 2175986

Browse files
Merge pull request #265 from cleandart/5.5.0-wip
Release react 5.5.0
2 parents e351e28 + 5203a95 commit 2175986

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+5225
-1878
lines changed

CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
1+
## [5.5.0](https://github.com/cleandart/react-dart/compare/5.4.0...5.5.0)
2+
3+
__New Features__
4+
5+
- 🎉 🎉 🎉 __Support for function components, memo and hooks!!!__ 🎉 🎉 🎉
6+
7+
Sooooo much work from so many amazing people made this possible, but to summarize:
8+
9+
- [#221] Add support for function components
10+
- [#252] Add support for `memo` higher order component
11+
- Hooks, hooks, and more hooks!
12+
- [#223] useState
13+
- [#233] useCallback
14+
- [#237] useContext
15+
- [#227] useEffect
16+
- [#248] useLayoutEffect
17+
- [#232] useReducer
18+
- [#245] useRef
19+
- [#250] useMemo
20+
- [#247] useImperativeHandle
21+
- [#246] useDebugValue
22+
23+
<p><br>It works like this...</p>
24+
25+
Define the component:
26+
```dart
27+
import 'package:react/react.dart' as react;
28+
29+
final SomeWidget = react.registerFunctionComponent(_SomeWidget, displayName: 'SomeWidget');
30+
31+
_SomeWidget(Map props) {
32+
// You can use hooks in here, too!
33+
34+
return react.div({}, [
35+
// Some children...
36+
]);
37+
}
38+
```
39+
40+
Render the component _(exact same consumer API as a class-based component)_:
41+
```dart
42+
import 'package:react/react_dom.dart' as react_dom;
43+
import 'some_widget.dart'; // Where your component is defined
44+
45+
main() {
46+
final renderedWidget = SomeWidget({
47+
// put some props here
48+
}, [
49+
// put some children here!
50+
]);
51+
52+
react_dom.render(renderedWidget, querySelector('#idOfSomeNodeInTheDom'));
53+
}
54+
```
55+
56+
> Check out all the [function component and hooks examples](https://github.com/cleandart/react-dart/blob/c9a1211d5d77a9e354b864e99ef8f52b60eeff85/example/test/function_component_test.dart) for more information!
57+
58+
__Fixes / Updates__
59+
- [#253] Deprecate `setClientConfiguration`.
60+
- It is no longer necessary - and can be removed from your implementations
61+
- [#273] Make `JsBackedMap.values` compatible with MSIE 11
62+
163
## [5.4.0](https://github.com/cleandart/react-dart/compare/5.3.0...5.4.0)
264
365
__New Features__

README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,10 @@ in the `main` entrypoint of your Dart application.
7171
```dart
7272
import 'dart:html';
7373
74-
import 'package:react/react_client.dart' as react_client;
7574
import 'package:react/react.dart';
7675
import 'package:react/react_dom.dart' as react_dom;
7776
7877
main() {
79-
// This should be called once at the beginning of the application.
80-
react_client.setClientConfiguration();
81-
8278
// Something to render... in this case a simple <div> with no props, and a string as its children.
8379
var component = div({}, "Hello world!");
8480
@@ -137,16 +133,12 @@ var aButton = button({"onClick": (SyntheticMouseEvent event) => print(event)});
137133
138134
import 'dart:html';
139135
140-
import 'package:react/react_client.dart' as react_client;
141136
import 'package:react/react.dart';
142137
import 'package:react/react_dom.dart' as react_dom;
143138
144139
import 'cool_widget.dart';
145140
146141
main() {
147-
// This should be called once at the beginning of the application.
148-
react_client.setClientConfiguration();
149-
150142
react_dom.render(CoolWidget({}), querySelector('#react_mount_point'));
151143
}
152144
```
@@ -173,16 +165,12 @@ var CoolWidget = registerComponent(() => new CoolWidgetComponent());
173165
174166
import 'dart:html';
175167
176-
import 'package:react/react_client.dart' as react_client;
177168
import 'package:react/react.dart';
178169
import 'package:react/react_dom.dart' as react_dom;
179170
180171
import 'cool_widget.dart';
181172
182173
main() {
183-
// This should be called once at the beginning of the application.
184-
react_client.setClientConfiguration();
185-
186174
react_dom.render(CoolWidget({"text": "Something"}), querySelector('#react_mount_point'));
187175
}
188176
```
@@ -225,16 +213,12 @@ class CoolWidgetComponent extends Component2 {
225213
226214
import 'dart:html';
227215
228-
import 'package:react/react_client.dart' as react_client;
229216
import 'package:react/react.dart';
230217
import 'package:react/react_dom.dart' as react_dom;
231218
232219
import 'cool_widget.dart';
233220
234221
void main() {
235-
// This should be called once at the beginning of the application.
236-
react_client.setClientConfiguration();
237-
238222
react_dom.render(
239223
myComponent(
240224
headline: "My custom headline",
@@ -352,7 +336,6 @@ Here is an example of how to use React React.addons.TestUtils. within a Dart tes
352336
```dart
353337
import 'package:test/test.dart';
354338
import 'package:react/react.dart' as react;
355-
import 'package:react/react_client.dart' as react_client;
356339
import 'package:react/react_dom.dart' as react_dom;
357340
import 'package:react/react_test_utils.dart' as react_test_utils;
358341
@@ -372,8 +355,6 @@ class MyTestComponent extends react.Component2 {
372355
var myTestComponent = react.registerComponent(() => new MyTestComponent());
373356
374357
void main() {
375-
react_client.setClientConfiguration();
376-
377358
test('should click button and set span text to "success"', () {
378359
var component = react_test_utils.renderIntoDocument(myTestComponent({}));
379360

dart_test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ presets:
1010

1111
dartdevc:
1212
exclude_tags: no-dartdevc
13+
14+
tags:
15+
"fails-on-241":

example/geocodes/geocodes.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'dart:html';
55

66
import 'package:react/react.dart' as react;
77
import 'package:react/react_dom.dart' as react_dom;
8-
import 'package:react/react_client.dart';
98

109
/**
1110
* Hello,
@@ -331,6 +330,5 @@ var geocodesApp = react.registerComponent(() => new _GeocodesApp());
331330
///
332331
/// Select the root of the app and the place in the DOM where it should be mounted.
333332
void main() {
334-
setClientConfiguration();
335333
react_dom.render(geocodesApp({}), querySelector('#content'));
336334
}

example/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ <h2 class="display-5">Use Case / Test Examples</h2>
5252
<li>
5353
<a href="js_components/index.html"><code>JsComponents</code> Example</a>
5454
</li>
55+
<li>
56+
<a href="test/function_component_test.html"><code>Function Component</code> test</a>
57+
</li>
5558
</ul>
5659

5760
</div>

example/js_components/js_components.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import 'package:react/react_client/react_interop.dart';
1010
import 'package:react/react_dom.dart' as react_dom;
1111

1212
main() {
13-
setClientConfiguration();
14-
1513
var content = IndexComponent({});
1614

1715
react_dom.render(content, querySelector('#content'));

example/test/call_and_nosuchmethod_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import "dart:html";
33

44
import "package:react/react_dom.dart" as react_dom;
55
import "package:react/react.dart" as react;
6-
import "package:react/react_client.dart";
76

87
class _CustomComponent extends react.Component {
98
render() {
@@ -14,8 +13,6 @@ class _CustomComponent extends react.Component {
1413
var customComponent = react.registerComponent(() => new _CustomComponent());
1514

1615
void main() {
17-
setClientConfiguration();
18-
1916
react_dom.render(
2017
react.div({}, [
2118
react.div({'key': 'noChildren'}),

example/test/context_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import 'dart:html';
22

33
import 'package:react/react.dart' as react;
44
import 'package:react/react_dom.dart' as react_dom;
5-
import 'package:react/react_client.dart';
65

76
import 'react_test_components.dart';
87

98
void main() {
10-
setClientConfiguration();
11-
129
react_dom.render(
1310
react.div({}, [
1411
react.h1({}, ['React Legacy Context API']),

example/test/false_and_null_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'dart:html';
33

44
import 'package:react/react.dart' as react;
55
import 'package:react/react_dom.dart' as react_dom;
6-
import 'package:react/react_client.dart';
76

87
class _Component extends react.Component {
98
render() {
@@ -18,8 +17,6 @@ class _Component extends react.Component {
1817
var component = react.registerComponent(() => new _Component());
1918

2019
void main() {
21-
setClientConfiguration();
22-
2320
var content = react.div({}, [
2421
react.p({}, 'Testing a dynamic return value of "null"...'),
2522
component({'returnValue': null, 'key': 0}),

0 commit comments

Comments
 (0)