Commit 4c58ad80 by Kristian Freeman

Move materials to application state

parent 9edf2780
......@@ -7,11 +7,22 @@ import Materials from './Materials'
const Header = () => <img className="logo" src="/logo.png" />
class App extends Component {
constructor() {
super()
this.state = {
materials: [
{ name: 'Dowel', count: 2 },
{ name: 'Screw', count: 8 },
{ name: 'Wheel', count: 3 }
]
}
}
render() {
const { materials } = this.state
return (
<div>
<Header />
<Materials />
<Materials materials={materials} />
</div>
);
}
......
......@@ -2,12 +2,7 @@ import React, { Component } from 'react';
class Materials extends Component {
render() {
const materials = [
{ name: 'Dowel', count: 2 },
{ name: 'Screw', count: 8 },
{ name: 'Wheel', count: 3 }
]
const { materials } = this.props
return (
<div>
<h2>Raw Materials</h2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment