Skip to content

Commit

Permalink
Make fields private
Browse files Browse the repository at this point in the history
+ So that over_react can override them with strong typing
+ Ref: Workiva/over_react#14
  • Loading branch information
keepsimple7 committed Oct 28, 2016
1 parent 2481751 commit 54a51c8
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/react.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,28 @@
/// A Dart library for building UI using ReactJS.
library react;

import 'dart:html';

/// Top-level ReactJS [Component class](https://facebook.github.io/react/docs/top-level-api.html#react.component)
/// which provides the [ReactJS Component API](https://facebook.github.io/react/docs/component-api.html)
abstract class Component {
Map _props;
Map _state = {};
dynamic _ref;

/// ReactJS `Component` props.
Map props;
Map get props => _props;
set props(Map value) => _props = value;

/// Provides access to the underlying DOM representation of the [render]ed `Component`.
dynamic ref;
/// ReactJS `Component` state.
Map get state => _state;
set state(Map value) => _state = value;

/// Returns the component of the specified [ref].
///
/// Returns a [Component] if it is a Dart component, otherwise returns an "Dom component" ([Element]).
dynamic get ref => _ref;
set ref(dynamic value) => _ref = value;

dynamic _jsRedraw;

Expand Down Expand Up @@ -57,9 +71,6 @@ abstract class Component {
transferComponentState();
}

/// ReactJS `Component` state.
Map state = {};

/// Private reference to the value of [state] from the previous render cycle.
///
/// Useful for ReactJS lifecycle methods [shouldComponentUpdate], [componentWillUpdate] and [componentDidUpdate].
Expand Down

0 comments on commit 54a51c8

Please sign in to comment.