Skip to content

Instantly share code, notes, and snippets.

@httpJunkie
Created October 16, 2018 13:39
Show Gist options
  • Save httpJunkie/0d5af9e79994d30fd35df75d161eb9bc to your computer and use it in GitHub Desktop.
Save httpJunkie/0d5af9e79994d30fd35df75d161eb9bc to your computer and use it in GitHub Desktop.
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