|
| 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 | +
|
1 | 63 | ## [5.4.0](https://github.com/cleandart/react-dart/compare/5.3.0...5.4.0)
|
2 | 64 |
|
3 | 65 | __New Features__
|
|
0 commit comments