-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathState.jsx
More file actions
29 lines (26 loc) · 778 Bytes
/
State.jsx
File metadata and controls
29 lines (26 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* ReactJS - State
* State is the place where data comes from. We should always try to make our state as simple
* as possible and minimize the number of stateful components. If we have 10 components that
* need data from the state, we should create one container component that will keep the state
* for all of them.
*/
import React from 'react';
class State extends React.Component {
constructor(props) {
super(props);
this.state = {
header: "Header from state...",
content: "Content from state..."
}
}
render() {
return (
<div>
<h1>{ this.state.header }</h1>
<h2>{ this.state.content }</h2>
</div>
);
}
}
export default State;