@@ -5,7 +5,7 @@ import { hasHooks } from './utils'
55export let isInsideFunctionComponent = false
66const COMPONENT = Symbol ( 'owner component' )
77
8- export default function view ( Comp ) {
8+ export default function view ( Comp ) {
99 const isStatelessComp = ! ( Comp . prototype && Comp . prototype . isReactComponent )
1010
1111 let ReactiveComp
@@ -47,7 +47,7 @@ export default function view(Comp) {
4747 // a HOC which overwrites render, shouldComponentUpdate and componentWillUnmount
4848 // it decides when to run the new reactive methods and when to proxy to the original methods
4949 class ReactiveClassComp extends BaseComp {
50- constructor ( props , context ) {
50+ constructor ( props , context ) {
5151 super ( props , context )
5252
5353 this . state = this . state || { }
@@ -60,12 +60,14 @@ export default function view(Comp) {
6060 } )
6161 }
6262
63- render ( ) {
64- return isStatelessComp ? Comp ( this . props , this . context ) : super . render ( )
63+ render ( ) {
64+ return isStatelessComp
65+ ? Comp ( this . props , this . context )
66+ : super . render ( )
6567 }
6668
6769 // react should trigger updates on prop changes, while easyState handles store changes
68- shouldComponentUpdate ( nextProps , nextState ) {
70+ shouldComponentUpdate ( nextProps , nextState ) {
6971 const { props, state } = this
7072
7173 // respect the case when the user defines a shouldComponentUpdate
@@ -88,7 +90,7 @@ export default function view(Comp) {
8890 }
8991
9092 // add a custom deriveStoresFromProps lifecyle method
91- static getDerivedStateFromProps ( props , state ) {
93+ static getDerivedStateFromProps ( props , state ) {
9294 if ( super . deriveStoresFromProps ) {
9395 // inject all local stores and let the user mutate them directly
9496 const stores = mapStateToStores ( state )
@@ -101,7 +103,7 @@ export default function view(Comp) {
101103 return null
102104 }
103105
104- componentWillUnmount ( ) {
106+ componentWillUnmount ( ) {
105107 // call user defined componentWillUnmount
106108 if ( super . componentWillUnmount ) {
107109 super . componentWillUnmount ( )
@@ -126,7 +128,7 @@ export default function view(Comp) {
126128 return ReactiveComp
127129}
128130
129- function mapStateToStores ( state ) {
131+ function mapStateToStores ( state ) {
130132 // find store properties and map them to their none observable raw value
131133 // to do not trigger none static this.setState calls
132134 // from the static getDerivedStateFromProps lifecycle method
0 commit comments