react_redurx 0.1.0

  • README.md
  • Example
  • Installing
  • Versions
  • 6

React-ReduRx

React bindings for ReduRx.

Usage

import 'dart:html' show querySelector;

import 'package:react/react.dart';
import 'package:react/react_client.dart' show setClientConfiguration;
import 'package:react/react_client/react_interop.dart';
import 'package:react/react_dom.dart' show render;
import 'package:react_redurx/react_redurx.dart';
import 'package:redurx/redurx.dart';

final app = registerComponent(() => App());
final foo = registerComponent(() => Foo());

class State {
  State(this.count);
  final int count;

  @override
  String toString() => '{count: $count}';
}

class Increment implements Action<State> {
  State reduce(State state) => State(state.count + 1);
}

class Foo extends Component {
  @override
  ReactElement render() => div({}, [
        props['value'],
        button({'onClick': (e) => props['increment']()}, '+')
      ]);
}

class App extends Component {
  @override
  ReactElement render() => connect<State>(
        (state) => {'value': state.count},
        (dispatch) => {'increment': () => dispatch(Increment())},
      )(foo);
}

void main() {
  setClientConfiguration();

  final store = Store<State>(State(0));
  final provider = registerComponent(() => Provider<State>(store: store));

  store.stream.listen(print);

  render(provider({}, app({})), querySelector('#root'));
}

example/main.dart

import 'dart:html' show querySelector;

import 'package:react/react.dart';
import 'package:react/react_client.dart' show setClientConfiguration;
import 'package:react/react_client/react_interop.dart';
import 'package:react/react_dom.dart' show render;
import 'package:react_redurx/react_redurx.dart';
import 'package:redurx/redurx.dart';

final app = registerComponent(() => App());
final foo = registerComponent(() => Foo());

class State {
  State(this.count);
  final int count;

  @override
  String toString() => '{count: $count}';
}

class Increment implements Action<State> {
  State reduce(State state) => State(state.count + 1);
}

class Foo extends Component {
  @override
  ReactElement render() => div({}, [
        props['value'],
        button({'onClick': (e) => props['increment']()}, '+')
      ]);
}

class App extends Component {
  @override
  ReactElement render() => connect<State>(
        (state) => {'value': state.count},
        (dispatch) => {'increment': () => dispatch(Increment())},
      )(foo);
}

void main() {
  setClientConfiguration();

  final store = Store<State>(State(0));
  final provider = registerComponent(() => Provider<State>(store: store));

  store.stream.listen(print);

  render(provider({}, app({})), querySelector('#root'));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  react_redurx: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:react_redurx/react_redurx.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jul 28, 2018 Go to the documentation of react_redurx 0.1.0 Download react_redurx 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
30
Overall:
Weighted score of the above. [more]
6
Learn more about scoring.

We analyzed this package on Dec 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms:

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: Git error. Command: git clone --mirror git://github.com/leocavalcante/react-dart.git /tmp/pub-cache-dirONUSWM/git/cache/react-dart-bd3fbc81b9e03afe6934f14be84c07028b2e19a1
 Cloning into bare repository '/tmp/pub-cache-dirONUSWM/git/cache/react-dart-bd3fbc81b9e03afe6934f14be84c07028b2e19a1'...
 fatal: remote error: 
   Repository not found.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0