react-dart

Dart Bindings for React JS

BSD-2-CLAUSE License

Stars
412
Committers
47

Bot releases are hidden (Show)

react-dart - 5.7.1

Published by joebingham-wk almost 4 years ago

react-dart - 5.5.0

Published by aaronlademann-wf about 4 years ago

This release of react includes...

New Features

  • 🎉 🎉 🎉 Support for function components, memo and hooks!!! 🎉 🎉 🎉

    Sooooo much work from so many amazing people made this possible, but to summarize:

    • #221 Add support for function components
    • #252 Add support for memo higher order component
    • Hooks, hooks, and more hooks!
      • #223 useState
      • #233 useCallback
      • #237 useContext
      • #227 useEffect
      • #248 useLayoutEffect
      • #232 useReducer
      • #245 useRef
      • #250 useMemo
      • #247 useImperativeHandle
      • #246 useDebugValue

    Define the component:

    import 'package:react/react.dart' as react;
    
    final SomeWidget = react.registerFunctionComponent(_SomeWidget, displayName: 'SomeWidget');
    
    _SomeWidget(Map props) {
      // You can use hooks in here, too!
      
      return react.div({}, [
        // Some children...
      ]);
    }
    

    Render the component (exact same consumer API as a class-based component):

    import 'package:react/react_dom.dart' as react_dom;
    import 'some_widget.dart'; // Where your component is defined
    
    main() {
      final renderedWidget = SomeWidget({
        // put some props here
      }, [
        // put some children here!
      ]);
    
      react_dom.render(renderedWidget, querySelector('#idOfSomeNodeInTheDom'));
    }
    

    Check out all the function component and hooks examples for more information!

Fixes / Updates

  • #253 Deprecate setClientConfiguration.
    • It is no longer necessary - and can be removed from your implementations
  • #273 Make JsBackedMap.values compatible with MSIE 11