Last active
March 19, 2017 20:16
-
-
Save andresmijares/2639fc13f9618b133dbc51f15f7e28b4 to your computer and use it in GitHub Desktop.
React Container View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Orders} from 'models' | |
import {ListOrdersComponent} from 'components' | |
function setOrderInfo (props, state) { | |
return { | |
some: props['some'], | |
info: props['info'], | |
here: props['here'], | |
// ... #props | |
} | |
} | |
const Order = React.createClass({ | |
// info omited to convience | |
getInitialState () { | |
return { | |
// all order information... | |
some: null, | |
info: null, | |
here: null, | |
} | |
}, | |
componentDidMount () { | |
this.setState(setOrderInfo) | |
}, | |
create (order) { | |
/* Not necessary an use cause, created for sample purposes only */ | |
let temp = Object.asign({}, order, { | |
some: this.state.some, | |
}) | |
this.model.create(temp) | |
}, | |
render () { | |
return ( | |
<ListOrdersComponent | |
model={orders} | |
info={this.state} | |
orders={this.props.orders} | |
create={this.create} | |
/> | |
) | |
}, | |
}) | |
const mapStateToProps = ({orders}) => { | |
return { | |
orders, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment