From becb8d0134b21dde8a81e36748ff44aceb6bacec Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 2 May 2017 14:29:11 -0400 Subject: [PATCH] created component --- js/components/heading.js | 9 +++++++++ js/index.js | 3 ++- js/mylib.js | 19 ------------------- 3 files changed, 11 insertions(+), 20 deletions(-) create mode 100644 js/components/heading.js delete mode 100644 js/mylib.js diff --git a/js/components/heading.js b/js/components/heading.js new file mode 100644 index 0000000..79df271 --- /dev/null +++ b/js/components/heading.js @@ -0,0 +1,9 @@ +import React from 'react'; + +class Heading extends React.Component { + render() { + return

Hello, {this.props.title}!

; + } +} + +export default Heading; diff --git a/js/index.js b/js/index.js index 64fb017..ce05bc4 100644 --- a/js/index.js +++ b/js/index.js @@ -1,7 +1,8 @@ import ReactDOM from 'react-dom'; import React from 'react'; +import Heading from './components/heading.js'; ReactDOM.render( -

Hello, world!

, + , document.querySelector('main') ); diff --git a/js/mylib.js b/js/mylib.js deleted file mode 100644 index 3f08203..0000000 --- a/js/mylib.js +++ /dev/null @@ -1,19 +0,0 @@ -const myFunc = function(){ - console.log('included!'); -} -const myFunc2 = function(){ - var a = 1; - var b = 2; - var c = {a,b}; - console.log(c); -} - -class Foo { - bar(){ - console.log('ya'); - } -} - -export default myFunc; - -export { myFunc2, Foo }