Created
October 16, 2018 13:39
-
-
Save httpJunkie/0d5af9e79994d30fd35df75d161eb9bc to your computer and use it in GitHub Desktop.
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 React from 'react'; | |
export default class SmartContainerComponent extends React.Component { | |
constructor() { | |
super() | |
this.state = { | |
products: [ | |
{ name: "Winged Fighter", productCode: "XJ1000" }, | |
{ name: "R2D2", productCode: "r2Dee2" } | |
] | |
} | |
} | |
render() { | |
return <DumbPresentationalComponent {...this.state} /> | |
} | |
} | |
const DumbPresentationalComponent = (props) => { | |
console.log(props) | |
return ( | |
<div> | |
{ | |
props.products.map((item, idx) => ( | |
<div>{idx} - {item.name}</div> | |
)) | |
} | |
</div> | |
) | |
} | |
// https://stackblitz.com/edit/react-smart-dumb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment