use class notation for home component
Seto Elkahfi committed
Mar 3, 2019 at 13:37 UTC
6a0e84f194fce8210410a4982c6a79b6197a0bb3
1 file changed
+24
-6
src/components/Home.js
+24
-6
@@ -1,4 +1,4 @@
1
-import React from 'react';
1
+import React, { Component } from 'react';
2
import ReactRotatingText from 'react-rotating-text';
3
4
const pStyle = {
@@ -57,11 +57,29 @@ var alterEgos = [
57
];
58
alterEgos = shuffle(alterEgos);
59
60
-const Home = () => (
61
- <div>
60
+class Home extends Component {
61
+
62
+ constructor(props) {
63
+ super(props);
64
+ this.state = {pStyle: pStyle, wordStyle: wordStyle, alterEgos: alterEgos}
65
+ }
66
+
67
+ componentDidMount() {
68
+
69
+ }
70
+
71
+ componentWillMount() {
72
+
73
+ }
74
+
75
+ render() {
76
+ return (
77
+ <div>
78
<h1>Hello, my name is Seto Elkahfi.</h1>
63
- <p style={pStyle}>I am <ReactRotatingText style={wordStyle } items={alterEgos}/></p>
64
- </div>
65
-);
79
+ <p style={this.state.pStyle}>I am <ReactRotatingText style={this.state.wordStyle} items={this.state.alterEgos}/></p>
80
+ </div>
81
+ );
82
+ }
83
+}
84
85
export default Home;