Skip to content

Commit bfbb49d

Browse files
authored
Merge pull request #4 from lumihq/phil/1
Give initialState access to props
2 parents f720bc1 + e46b841 commit bfbb49d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: src/React/Basic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var React = require('react');
55
exports.react_ = function(spec) {
66
return React.createClass({
77
getInitialState: function() {
8-
return spec.initialState;
8+
return spec.initialState(this.props);
99
},
1010
render: function() {
1111
var this_ = this;

Diff for: src/React/Basic.purs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import React.Basic.Types as React.Basic.Types
1414

1515
foreign import react_
1616
:: forall props state
17-
. { initialState :: state
17+
. { initialState :: props -> state
1818
, render :: Fn3 props state (state -> Eff (react :: ReactFX) Unit) JSX
1919
}
2020
-> ReactComponent props
@@ -30,7 +30,7 @@ foreign import react_
3030
-- | module (and re-exported here).
3131
react
3232
:: forall props state
33-
. { initialState :: state
33+
. { initialState :: props -> state
3434
, render :: props -> state -> (state -> Eff (react :: ReactFX) Unit) -> JSX
3535
}
3636
-> ReactComponent props

0 commit comments

Comments
 (0)